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/cork.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/cork.c')
-rw-r--r-- | test/cork.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/test/cork.c b/test/cork.c index 7628d28..53d9065 100644 --- a/test/cork.c +++ b/test/cork.c @@ -396,7 +396,7 @@ verify_obj_dset_cork(hbool_t swmr) /* Attach 8 attributes to the dataset */ for (i = 0; i < 8; i++) { - HDsprintf(attrname, "attr %d", i); + HDsnprintf(attrname, sizeof(attrname), "attr %d", i); if ((aid = H5Acreate2(did2, attrname, H5T_NATIVE_INT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; if (H5Awrite(aid, H5T_NATIVE_INT, &i) < 0) @@ -864,7 +864,7 @@ verify_group_cork(hbool_t swmr) /* Attach 8 attributes to the third group: GRP3 */ for (i = 0; i < 8; i++) { - HDsprintf(attrname, "attr %d", i); + HDsnprintf(attrname, sizeof(attrname), "attr %d", i); if ((aid = H5Acreate2(gid3, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; if (H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0) @@ -1081,7 +1081,7 @@ verify_named_cork(hbool_t swmr) /* Attach 8 attributes to datatype: DT3 */ for (i = 0; i < 8; i++) { - HDsprintf(attrname, "attr %d", i); + HDsnprintf(attrname, sizeof(attrname), "attr %d", i); if ((aid = H5Acreate2(tid3, attrname, H5T_NATIVE_UINT, sid, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; if (H5Awrite(aid, H5T_NATIVE_UINT, &i) < 0) |