diff options
author | Sean McBride <sean@rogue-research.com> | 2022-01-28 16:34:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-28 16:34:57 (GMT) |
commit | b5eed1b56324fc07154c2e2d8251d2b87505ca23 (patch) | |
tree | b3e3840a886966ae07e50a69ab7492ebe4df876c /test | |
parent | 44de59b642c4d5ccf505a1072d10b63dc9fe0628 (diff) | |
download | hdf5-b5eed1b56324fc07154c2e2d8251d2b87505ca23.zip hdf5-b5eed1b56324fc07154c2e2d8251d2b87505ca23.tar.gz hdf5-b5eed1b56324fc07154c2e2d8251d2b87505ca23.tar.bz2 |
Replaced several uses of sprintf with safer snprintf (#1383)
* Replaced several uses of sprintf with safer snprintf
* Committing clang-format changes
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/chunk_info.c | 2 | ||||
-rw-r--r-- | test/flush1.c | 2 | ||||
-rw-r--r-- | test/flush2.c | 2 | ||||
-rw-r--r-- | test/unregister.c | 2 |
4 files changed, 4 insertions, 4 deletions
diff --git a/test/chunk_info.c b/test/chunk_info.c index 148c577..2bec42d 100644 --- a/test/chunk_info.c +++ b/test/chunk_info.c @@ -421,7 +421,7 @@ verify_idx_nchunks(hid_t dset, hid_t dspace, H5D_chunk_index_t exp_idx_type, hsi /* Ensure the correct chunk indexing scheme is used */ if (idx_type != exp_idx_type) { char msg[256]; - HDsprintf(msg, "Should be using %s.\n", index_type_str(idx_type)); + HDsnprintf(msg, sizeof(msg), "Should be using %s.\n", index_type_str(idx_type)); FAIL_PUTS_ERROR(msg); } diff --git a/test/flush1.c b/test/flush1.c index f5c4e2b..0ddceb6 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -81,7 +81,7 @@ create_file(const char *filename, hid_t fapl_id, hbool_t swmr) if ((top_gid = H5Gcreate2(fid, "top_group", H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) STACK_ERROR for (i = 0; i < NGROUPS; i++) { - HDsprintf(group_name, "group%02d", i); + HDsnprintf(group_name, sizeof(group_name), "group%02d", i); if ((gid = H5Gcreate2(top_gid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) STACK_ERROR if (H5Gclose(gid) < 0) diff --git a/test/flush2.c b/test/flush2.c index bf1187b..b6c7761 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -144,7 +144,7 @@ file_ok(const char *filename, hid_t fapl_id, hbool_t check_second_dset) if ((top_gid = H5Gopen2(fid, "top_group", H5P_DEFAULT)) < 0) goto error; for (i = 0; i < NGROUPS; i++) { - HDsprintf(group_name, "group%02d", i); + HDsnprintf(group_name, sizeof(group_name), "group%02d", i); if ((gid = H5Gopen2(top_gid, group_name, H5P_DEFAULT)) < 0) goto error; if (H5Gclose(gid) < 0) diff --git a/test/unregister.c b/test/unregister.c index 803f8373..ebb51b1 100644 --- a/test/unregister.c +++ b/test/unregister.c @@ -136,7 +136,7 @@ test_unregister_filters(hid_t fapl_id) /* Create multiple groups under the main group */ for (i = 0; i < GROUP_ITERATION; i++) { - HDsprintf(group_name, "group_%d", i); + HDsnprintf(group_name, sizeof(group_name), "group_%d", i); if ((gid_loop = H5Gcreate2(gid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) goto error; if (H5Gclose(gid_loop) < 0) |