summaryrefslogtreecommitdiffstats
path: root/test/reserved.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/reserved.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/reserved.c')
-rw-r--r--test/reserved.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/reserved.c b/test/reserved.c
index f864329..08e747e 100644
--- a/test/reserved.c
+++ b/test/reserved.c
@@ -71,7 +71,7 @@ rsrv_heap(void)
}
H5E_END_TRY
- HDsprintf(dset_name, "Dset %d", i);
+ HDsnprintf(dset_name, sizeof(dset_name), "Dset %d", i);
H5E_BEGIN_TRY
{
@@ -115,7 +115,7 @@ rsrv_heap(void)
if (H5open() < 0)
TEST_ERROR;
- HDsprintf(dset_name, "Dset %d", i - 2);
+ HDsnprintf(dset_name, sizeof(dset_name), "Dset %d", i - 2);
file_id = H5Fopen(filename, H5F_ACC_RDONLY, H5P_DEFAULT);
if (file_id < 0)
@@ -218,7 +218,7 @@ rsrv_ohdr(void)
} /* end for */
for (i = 0; i < 2000; i++) {
- HDsprintf(attrname, "attr %d", i);
+ HDsnprintf(attrname, sizeof(attrname), "attr %d", i);
H5E_BEGIN_TRY
{
aid = H5Screate_simple(2, dims, NULL);