summaryrefslogtreecommitdiffstats
path: root/test/vfd.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/vfd.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/vfd.c')
-rw-r--r--test/vfd.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/vfd.c b/test/vfd.c
index d6f6d61..b4fc742 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -1538,19 +1538,19 @@ test_multi(void)
memb_map[H5FD_MEM_BTREE] = H5FD_MEM_BTREE;
memb_map[H5FD_MEM_GHEAP] = H5FD_MEM_GHEAP;
- HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's');
+ HDsnprintf(sv[H5FD_MEM_SUPER], 32, "%%s-%c.h5", 's');
memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER];
memb_addr[H5FD_MEM_SUPER] = 0;
- HDsprintf(sv[H5FD_MEM_BTREE], "%%s-%c.h5", 'b');
+ HDsnprintf(sv[H5FD_MEM_BTREE], 32, "%%s-%c.h5", 'b');
memb_name[H5FD_MEM_BTREE] = sv[H5FD_MEM_BTREE];
memb_addr[H5FD_MEM_BTREE] = HADDR_MAX / 4;
- HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r');
+ HDsnprintf(sv[H5FD_MEM_DRAW], 32, "%%s-%c.h5", 'r');
memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW];
memb_addr[H5FD_MEM_DRAW] = HADDR_MAX / 2;
- HDsprintf(sv[H5FD_MEM_GHEAP], "%%s-%c.h5", 'g');
+ HDsnprintf(sv[H5FD_MEM_GHEAP], 32, "%%s-%c.h5", 'g');
memb_name[H5FD_MEM_GHEAP] = sv[H5FD_MEM_GHEAP];
memb_addr[H5FD_MEM_GHEAP] = (HADDR_MAX / 4) * 3;
@@ -1787,12 +1787,12 @@ test_multi_compat(void)
memb_map[H5FD_MEM_DRAW] = H5FD_MEM_DRAW;
memb_fapl[H5FD_MEM_SUPER] = H5P_DEFAULT;
- HDsprintf(sv[H5FD_MEM_SUPER], "%%s-%c.h5", 's');
+ HDsnprintf(sv[H5FD_MEM_SUPER], 32, "%%s-%c.h5", 's');
memb_name[H5FD_MEM_SUPER] = sv[H5FD_MEM_SUPER];
memb_addr[H5FD_MEM_SUPER] = 0;
memb_fapl[H5FD_MEM_DRAW] = H5P_DEFAULT;
- HDsprintf(sv[H5FD_MEM_DRAW], "%%s-%c.h5", 'r');
+ HDsnprintf(sv[H5FD_MEM_DRAW], 32, "%%s-%c.h5", 'r');
memb_name[H5FD_MEM_DRAW] = sv[H5FD_MEM_DRAW];
memb_addr[H5FD_MEM_DRAW] = HADDR_MAX / 2;
@@ -1804,12 +1804,12 @@ test_multi_compat(void)
/* Make copy for the data file in the build directory, to protect the
* original file in the source directory
*/
- HDsprintf(filename_s, "%s-%c.h5", MULTI_COMPAT_BASENAME, 's');
- HDsprintf(newname_s, "%s-%c.h5", FILENAME[9], 's');
+ HDsnprintf(filename_s, sizeof(filename_s), "%s-%c.h5", MULTI_COMPAT_BASENAME, 's');
+ HDsnprintf(newname_s, sizeof(newname_s), "%s-%c.h5", FILENAME[9], 's');
h5_make_local_copy(filename_s, newname_s);
- HDsprintf(filename_r, "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r');
- HDsprintf(newname_r, "%s-%c.h5", FILENAME[9], 'r');
+ HDsnprintf(filename_r, sizeof(filename_r), "%s-%c.h5", MULTI_COMPAT_BASENAME, 'r');
+ HDsnprintf(newname_r, sizeof(newname_r), "%s-%c.h5", FILENAME[9], 'r');
h5_make_local_copy(filename_r, newname_r);
/* Reopen the file for read only. Verify 1.8 library can open file