summaryrefslogtreecommitdiffstats
path: root/tools/src/h5repack
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 /tools/src/h5repack
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 'tools/src/h5repack')
-rw-r--r--tools/src/h5repack/h5repack_copy.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c
index c38a431..25df5c7 100644
--- a/tools/src/h5repack/h5repack_copy.c
+++ b/tools/src/h5repack/h5repack_copy.c
@@ -1531,7 +1531,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr, pack_opt_
{
unsigned level = cd_values[0];
- HDsprintf(temp, "(%d)", level);
+ HDsnprintf(temp, sizeof(temp), "(%d)", level);
HDstrcat(strfilter, temp);
}
#endif
@@ -1545,7 +1545,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr, pack_opt_
unsigned options_mask = cd_values[0]; /* from dcpl, not filt*/
unsigned ppb = cd_values[1];
- HDsprintf(temp, "(%d,", ppb);
+ HDsnprintf(temp, sizeof(temp), "(%d,", ppb);
HDstrcat(strfilter, temp);
if (options_mask & H5_SZIP_EC_OPTION_MASK)
HDstrcpy(temp, "EC) ");
@@ -1588,7 +1588,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr, pack_opt_
HDstrcpy(str, "dset ");
HDstrcat(str, strfilter);
- HDsprintf(temp, " (%.3f:1)", ratio);
+ HDsnprintf(temp, sizeof(temp), " (%.3f:1)", ratio);
HDstrcat(str, temp);
if (options->verbose == 2)
HDprintf(FORMAT_OBJ_TIME, str, read_time, write_time, objname);