summaryrefslogtreecommitdiffstats
path: root/tools/test/h5repack/h5repacktst.c
diff options
context:
space:
mode:
authorSean McBride <sean@rogue-research.com>2022-06-22 18:58:18 (GMT)
committerGitHub <noreply@github.com>2022-06-22 18:58:18 (GMT)
commitc064d3481b582653c1e0d0043a17527fd73e8c4d (patch)
tree396a5e13954c19b803aa80465938cde15140b176 /tools/test/h5repack/h5repacktst.c
parentd6f05069c1a3642bbebf7ec27e7df809f0675f13 (diff)
downloadhdf5-c064d3481b582653c1e0d0043a17527fd73e8c4d.zip
hdf5-c064d3481b582653c1e0d0043a17527fd73e8c4d.tar.gz
hdf5-c064d3481b582653c1e0d0043a17527fd73e8c4d.tar.bz2
sprintf to snprintf (#1815)
* Straightforward conversion of sprintf to the safer snprintf * Trickier conversion of sprintf to safer snprintf This involved minor changes to private function signatures to take the size of the buffer. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'tools/test/h5repack/h5repacktst.c')
-rw-r--r--tools/test/h5repack/h5repacktst.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c
index 8b114e4..028939a 100644
--- a/tools/test/h5repack/h5repacktst.c
+++ b/tools/test/h5repack/h5repacktst.c
@@ -3157,7 +3157,7 @@ make_early(void)
goto out;
if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0)
goto out;
- HDsprintf(name, "%d", i);
+ HDsnprintf(name, sizeof(name), "%d", i);
if ((H5Tcommit2(fid, name, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if (H5Tclose(tid) < 0)
@@ -3181,7 +3181,7 @@ make_early(void)
for (i = 0; i < iter; i++) {
if ((tid = H5Tcopy(H5T_NATIVE_DOUBLE)) < 0)
goto out;
- HDsprintf(name, "%d", i);
+ HDsnprintf(name, sizeof(name), "%d", i);
if ((H5Tcommit2(fid, name, tid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0)
goto out;
if (H5Tclose(tid) < 0)
@@ -3240,7 +3240,7 @@ make_layout(hid_t loc_id)
*-------------------------------------------------------------------------
*/
for (i = 0; i < 4; i++) {
- HDsprintf(name, "dset%d", i + 1);
+ HDsnprintf(name, sizeof(name), "dset%d", i + 1);
if (write_dset(loc_id, RANK, dims, name, H5T_NATIVE_INT, buf) < 0)
goto error;
}