summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
authorSean McBride <sean@rogue-research.com>2022-01-28 16:34:57 (GMT)
committerGitHub <noreply@github.com>2022-01-28 16:34:57 (GMT)
commitb5eed1b56324fc07154c2e2d8251d2b87505ca23 (patch)
treeb3e3840a886966ae07e50a69ab7492ebe4df876c /hl
parent44de59b642c4d5ccf505a1072d10b63dc9fe0628 (diff)
downloadhdf5-b5eed1b56324fc07154c2e2d8251d2b87505ca23.zip
hdf5-b5eed1b56324fc07154c2e2d8251d2b87505ca23.tar.gz
hdf5-b5eed1b56324fc07154c2e2d8251d2b87505ca23.tar.bz2
Replaced several uses of sprintf with safer snprintf (#1383)
* Replaced several uses of sprintf with safer snprintf * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'hl')
-rw-r--r--hl/tools/gif2h5/writehdf.c2
-rw-r--r--hl/tools/h5watch/h5watch.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/hl/tools/gif2h5/writehdf.c b/hl/tools/gif2h5/writehdf.c
index c321519..b49e2a6 100644
--- a/hl/tools/gif2h5/writehdf.c
+++ b/hl/tools/gif2h5/writehdf.c
@@ -100,7 +100,7 @@ WriteHDF(GIFTOMEM GifMemoryStruct, char *HDFName)
dims[1] = gifImageDesc->ImageWidth;
/* create the image name */
- sprintf(ImageName, "Image%d", i);
+ snprintf(ImageName, sizeof(ImageName), "Image%d", i);
/* write image */
if (H5IMmake_image_8bit(file_id, ImageName, dims[1], dims[0], (gifImageDesc->Image)) < 0)
diff --git a/hl/tools/h5watch/h5watch.c b/hl/tools/h5watch/h5watch.c
index c897c91..94ca4f1 100644
--- a/hl/tools/h5watch/h5watch.c
+++ b/hl/tools/h5watch/h5watch.c
@@ -174,9 +174,9 @@ doprint(hid_t did, const hsize_t *start, const hsize_t *block, int rank)
} /* end else */
/* Floating point types should display full precision */
- sprintf(fmt_float, "%%1.%dg", FLT_DIG);
+ snprintf(fmt_float, sizeof(fmt_float), "%%1.%dg", FLT_DIG);
info.fmt_float = fmt_float;
- sprintf(fmt_double, "%%1.%dg", DBL_DIG);
+ snprintf(fmt_double, sizeof(fmt_double), "%%1.%dg", DBL_DIG);
info.fmt_double = fmt_double;
info.dset_format = "DSET-%s ";