summaryrefslogtreecommitdiffstats
path: root/tools/src/h5dump
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-04-25 23:49:04 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-05-20 14:37:20 (GMT)
commit3efed9c1110521a8361603436984a677f2bbea29 (patch)
tree5b676c2e131f18603b23dc8c67b142ded45ae3f9 /tools/src/h5dump
parent97431e256b70a393605d515f186e914a044a3fee (diff)
downloadhdf5-3efed9c1110521a8361603436984a677f2bbea29.zip
hdf5-3efed9c1110521a8361603436984a677f2bbea29.tar.gz
hdf5-3efed9c1110521a8361603436984a677f2bbea29.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 5a5bb13..f599b7e 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;