summaryrefslogtreecommitdiffstats
path: root/tools/src/h5dump
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-04-25 23:49:04 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-04-25 23:49:04 (GMT)
commita8676d74d9fc50c0da4dcf4cf5646e4a8b2352ba (patch)
treee10dce719d3ddb94a1a89c9c498a2df23f2df2b2 /tools/src/h5dump
parente54f5a14d28cf9eb1226ce7feab2e2600d3984b4 (diff)
downloadhdf5-a8676d74d9fc50c0da4dcf4cf5646e4a8b2352ba.zip
hdf5-a8676d74d9fc50c0da4dcf4cf5646e4a8b2352ba.tar.gz
hdf5-a8676d74d9fc50c0da4dcf4cf5646e4a8b2352ba.tar.bz2
Fixes for warnings in the tools code.
Diffstat (limited to 'tools/src/h5dump')
-rw-r--r--tools/src/h5dump/h5dump_xml.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index 4f58b73..7edd962 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -732,7 +732,7 @@ xml_escape_the_name(const char *str)
* Programmer: REMcG
*-------------------------------------------------------------------------
*/
-static char *
+static char *
xml_escape_the_string(const char *str, int slen)
{
size_t extra;
@@ -794,18 +794,22 @@ xml_escape_the_string(const char *str, int slen)
else if (*cp == '\'') {
esc_len = HDstrlen(apos);
HDstrncpy(ncp, apos, esc_len);
+ ncp[sizeof(ncp) - 1] = '\0';
}
else if (*cp == '<') {
esc_len = HDstrlen(lt);
HDstrncpy(ncp, lt, esc_len);
+ ncp[sizeof(ncp) - 1] = '\0';
}
else if (*cp == '>') {
esc_len = HDstrlen(gt);
HDstrncpy(ncp, gt, esc_len);
+ ncp[sizeof(ncp) - 1] = '\0';
}
else if (*cp == '&') {
esc_len = HDstrlen(amp);
HDstrncpy(ncp, amp, esc_len);
+ ncp[sizeof(ncp) - 1] = '\0';
}
else {
*ncp = *cp;