diff options
author | Sean McBride <sean@rogue-research.com> | 2022-01-28 22:43:48 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-28 22:43:48 (GMT) |
commit | 4ac6ccc0213767be935b2686524937ae93c46e3f (patch) | |
tree | 9cd332106bd623c05f8e6837bed0d1ceab5ad7e9 /tools/src/h5perf | |
parent | ad71539d30c799c497953c18352df37d83a75310 (diff) | |
download | hdf5-4ac6ccc0213767be935b2686524937ae93c46e3f.zip hdf5-4ac6ccc0213767be935b2686524937ae93c46e3f.tar.gz hdf5-4ac6ccc0213767be935b2686524937ae93c46e3f.tar.bz2 |
Snprintf2 (#1399)
* Replaced many uses of sprintf with safer snprintf
Many very straightforward, but in a few cases added a length parameter to some private functions, because buffer length was otherwise unknowable.
* Removed unnecessary use of static on small buffers
This improves thread safety.
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'tools/src/h5perf')
-rw-r--r-- | tools/src/h5perf/pio_engine.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/src/h5perf/pio_engine.c b/tools/src/h5perf/pio_engine.c index 3edc74a..e316245 100644 --- a/tools/src/h5perf/pio_engine.c +++ b/tools/src/h5perf/pio_engine.c @@ -282,7 +282,7 @@ do_pio(parameters param) /* Open file for write */ char base_name[256]; - HDsprintf(base_name, "#pio_tmp_%lu", nf); + HDsnprintf(base_name, sizeof(base_name), "#pio_tmp_%lu", nf); pio_create_filename(iot, base_name, fname, sizeof(fname)); if (pio_debug_level > 0) HDfprintf(output, "rank %d: data filename=%s\n", pio_mpi_rank_g, fname); @@ -898,7 +898,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nby } /* end if */ } /* end else */ - HDsprintf(dname, "Dataset_%ld", ndset); + HDsnprintf(dname, sizeof(dname), "Dataset_%ld", ndset); h5ds_id = H5DCREATE(fd->h5fd, dname, ELMT_H5_TYPE, h5dset_space_id, h5dcpl); if (h5ds_id < 0) { @@ -1879,7 +1879,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets, off_t nbyt break; case PHDF5: - HDsprintf(dname, "Dataset_%ld", ndset); + HDsnprintf(dname, sizeof(dname), "Dataset_%ld", ndset); h5ds_id = H5DOPEN(fd->h5fd, dname); if (h5ds_id < 0) { HDfprintf(stderr, "HDF5 Dataset open failed\n"); |