summaryrefslogtreecommitdiffstats
path: root/test/dtypes.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/dtypes.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/dtypes.c')
-rw-r--r--test/dtypes.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/dtypes.c b/test/dtypes.c
index a6b2beb..d2064b7 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -4969,7 +4969,7 @@ test_conv_str_2(void)
} /* end for */
/* Do the conversions */
- HDsprintf(s, "Testing random string conversion speed");
+ HDsnprintf(s, sizeof(s), "Testing random string conversion speed");
HDprintf("%-70s", s);
HDfflush(stdout);
if (H5Tconvert(c_type, f_type, nelmts, buf, NULL, H5P_DEFAULT) < 0)
@@ -5184,14 +5184,14 @@ test_conv_enum_1(void)
buf[u] = HDrand() % 26;
/* Conversions */
- HDsprintf(s, "Testing random enum conversion O(N)");
+ HDsnprintf(s, sizeof(s), "Testing random enum conversion O(N)");
HDprintf("%-70s", s);
HDfflush(stdout);
if (H5Tconvert(t1, t2, nelmts, buf, NULL, H5P_DEFAULT) < 0)
goto error;
PASSED();
- HDsprintf(s, "Testing random enum conversion O(N log N)");
+ HDsnprintf(s, sizeof(s), "Testing random enum conversion O(N log N)");
HDprintf("%-70s", s);
HDfflush(stdout);
if (H5Tconvert(t2, t1, nelmts, buf, NULL, H5P_DEFAULT) < 0)