summaryrefslogtreecommitdiffstats
path: root/tools/src
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-04-26 09:54:29 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-04-26 09:54:29 (GMT)
commitde3bfa697a9fcb4fabf755b2bda7fa553abfcebb (patch)
treeac3fa249bba993c42bb5f532072d4f23f4c2197c /tools/src
parenta8676d74d9fc50c0da4dcf4cf5646e4a8b2352ba (diff)
downloadhdf5-de3bfa697a9fcb4fabf755b2bda7fa553abfcebb.zip
hdf5-de3bfa697a9fcb4fabf755b2bda7fa553abfcebb.tar.gz
hdf5-de3bfa697a9fcb4fabf755b2bda7fa553abfcebb.tar.bz2
Updates to tools warning PR from code review.
Diffstat (limited to 'tools/src')
-rw-r--r--tools/src/h5dump/h5dump_xml.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index 7edd962..bd822bc 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -792,24 +792,20 @@ xml_escape_the_string(const char *str, int slen)
esc_len = 1;
}
else if (*cp == '\'') {
+ HDstrncpy(ncp, apos, ncp_len);
esc_len = HDstrlen(apos);
- HDstrncpy(ncp, apos, esc_len);
- ncp[sizeof(ncp) - 1] = '\0';
}
else if (*cp == '<') {
+ HDstrncpy(ncp, lt, ncp_len);
esc_len = HDstrlen(lt);
- HDstrncpy(ncp, lt, esc_len);
- ncp[sizeof(ncp) - 1] = '\0';
}
else if (*cp == '>') {
+ HDstrncpy(ncp, gt, ncp_len);
esc_len = HDstrlen(gt);
- HDstrncpy(ncp, gt, esc_len);
- ncp[sizeof(ncp) - 1] = '\0';
}
else if (*cp == '&') {
+ HDstrncpy(ncp, amp, ncp_len);
esc_len = HDstrlen(amp);
- HDstrncpy(ncp, amp, esc_len);
- ncp[sizeof(ncp) - 1] = '\0';
}
else {
*ncp = *cp;