summaryrefslogtreecommitdiffstats
path: root/test/titerate.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 /test/titerate.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 'test/titerate.c')
-rw-r--r--test/titerate.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/titerate.c b/test/titerate.c
index 1d87343..5796f11 100644
--- a/test/titerate.c
+++ b/test/titerate.c
@@ -156,7 +156,7 @@ test_iter_group(hid_t fapl, hbool_t new_format)
CHECK(filespace, FAIL, "H5Screate");
for (i = 0; i < NDATASETS; i++) {
- HDsprintf(name, "Dataset %d", i);
+ HDsnprintf(name, sizeof(name), "Dataset %d", i);
dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");
@@ -436,7 +436,7 @@ test_iter_attr(hid_t fapl, hbool_t new_format)
CHECK(dataset, FAIL, "H5Dcreate2");
for (i = 0; i < NATTR; i++) {
- HDsprintf(name, "Attribute %02d", i);
+ HDsnprintf(name, sizeof(name), "Attribute %02d", i);
attribute = H5Acreate2(dataset, name, H5T_NATIVE_INT, filespace, H5P_DEFAULT, H5P_DEFAULT);
CHECK(attribute, FAIL, "H5Acreate2");
@@ -649,7 +649,7 @@ test_iter_group_large(hid_t fapl)
/* Create a bunch of groups */
for (i = 0; i < ITER_NGROUPS; i++) {
- HDsprintf(gname, "Group_%d", i);
+ HDsnprintf(gname, sizeof(gname), "Group_%d", i);
/* Add the name to the list of objects in the root group */
HDstrcpy(names[i].name, gname);
@@ -766,7 +766,7 @@ test_grp_memb_funcs(hid_t fapl)
CHECK(filespace, FAIL, "H5Screate");
for (i = 0; i < NDATASETS; i++) {
- HDsprintf(name, "Dataset %d", i);
+ HDsnprintf(name, sizeof(name), "Dataset %d", i);
dataset = H5Dcreate2(file, name, datatype, filespace, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
CHECK(dataset, FAIL, "H5Dcreate2");