summaryrefslogtreecommitdiffstats
path: root/test/external_common.c
diff options
context:
space:
mode:
authorSean McBride <sean@rogue-research.com>2022-01-28 22:43:48 (GMT)
committerGitHub <noreply@github.com>2022-01-28 22:43:48 (GMT)
commit4ac6ccc0213767be935b2686524937ae93c46e3f (patch)
tree9cd332106bd623c05f8e6837bed0d1ceab5ad7e9 /test/external_common.c
parentad71539d30c799c497953c18352df37d83a75310 (diff)
downloadhdf5-4ac6ccc0213767be935b2686524937ae93c46e3f.zip
hdf5-4ac6ccc0213767be935b2686524937ae93c46e3f.tar.gz
hdf5-4ac6ccc0213767be935b2686524937ae93c46e3f.tar.bz2
Snprintf2 (#1399)
* Replaced many uses of sprintf with safer snprintf Many very straightforward, but in a few cases added a length parameter to some private functions, because buffer length was otherwise unknowable. * Removed unnecessary use of static on small buffers This improves thread safety. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'test/external_common.c')
-rw-r--r--test/external_common.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/external_common.c b/test/external_common.c
index c37fd16..3f04260 100644
--- a/test/external_common.c
+++ b/test/external_common.c
@@ -59,9 +59,9 @@ reset_raw_data_files(hbool_t is_env)
/* Open file */
if (is_env)
- HDsprintf(filename, "extern_env_%lur.raw", (unsigned long)i + 1);
+ HDsnprintf(filename, sizeof(filename), "extern_env_%lur.raw", (unsigned long)i + 1);
else
- HDsprintf(filename, "extern_%lur.raw", (unsigned long)i + 1);
+ HDsnprintf(filename, sizeof(filename), "extern_%lur.raw", (unsigned long)i + 1);
if ((fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
goto error;
@@ -96,9 +96,9 @@ reset_raw_data_files(hbool_t is_env)
/* Open file */
if (is_env)
- HDsprintf(filename, "extern_env_%luw.raw", (unsigned long)i + 1);
+ HDsnprintf(filename, sizeof(filename), "extern_env_%luw.raw", (unsigned long)i + 1);
else
- HDsprintf(filename, "extern_%luw.raw", (unsigned long)i + 1);
+ HDsnprintf(filename, sizeof(filename), "extern_%luw.raw", (unsigned long)i + 1);
if ((fd = HDopen(filename, O_RDWR | O_CREAT | O_TRUNC, H5_POSIX_CREATE_MODE_RW)) < 0)
goto error;