diff options
author | Sean McBride <sean@rogue-research.com> | 2022-06-22 18:58:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-22 18:58:18 (GMT) |
commit | c064d3481b582653c1e0d0043a17527fd73e8c4d (patch) | |
tree | 396a5e13954c19b803aa80465938cde15140b176 /test/cache_tagging.c | |
parent | d6f05069c1a3642bbebf7ec27e7df809f0675f13 (diff) | |
download | hdf5-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 'test/cache_tagging.c')
-rw-r--r-- | test/cache_tagging.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 4d07116..f1571f0 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -839,7 +839,7 @@ check_multi_group_creation_tags(void) for (i = 0; i < MULTIGROUPS; i++) { - HDsprintf(gname, "%d", i); + HDsnprintf(gname, sizeof(gname), "%d", i); if ((gid = H5Gcreate2(fid, gname, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; if (H5Gclose(gid) < 0) @@ -861,7 +861,7 @@ check_multi_group_creation_tags(void) for (i = 0; i < MULTIGROUPS; i++) { /* Re-open the group */ - HDsprintf(gname, "%d", i); + HDsnprintf(gname, sizeof(gname), "%d", i); if ((gid = H5Gopen2(fid, gname, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -988,7 +988,7 @@ check_link_iteration_tags(void) /* Create many datasets in root group */ for (i = 0; i < 500; i++) { - HDsprintf(dsetname, "Dset %d", i); + HDsnprintf(dsetname, sizeof(dsetname), "Dset %d", i); if ((did = H5Dcreate2(fid, dsetname, H5T_NATIVE_UCHAR, sid, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; @@ -1151,7 +1151,7 @@ check_dense_attribute_tags(void) for (i = 0; i < 50; i++) { - HDsprintf(attrname, "attr %d", i); + HDsnprintf(attrname, sizeof(attrname), "attr %d", i); if ((aid = H5Acreate2(did, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; if (H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0) |