summaryrefslogtreecommitdiffstats
path: root/tools/src/h5dump/h5dump_xml.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-04-26 09:54:29 (GMT)
committerDavid Young <dyoung@hdfgroup.org>2020-05-20 14:37:20 (GMT)
commite0d954f8455fed5ff46faf0194fc9cb5a9c8e359 (patch)
tree317f5e73afecc9f4e5924c09a35607f9e3f5f480 /tools/src/h5dump/h5dump_xml.c
parent3efed9c1110521a8361603436984a677f2bbea29 (diff)
downloadhdf5-e0d954f8455fed5ff46faf0194fc9cb5a9c8e359.zip
hdf5-e0d954f8455fed5ff46faf0194fc9cb5a9c8e359.tar.gz
hdf5-e0d954f8455fed5ff46faf0194fc9cb5a9c8e359.tar.bz2
Updates to tools warning PR from code review.
Diffstat (limited to 'tools/src/h5dump/h5dump_xml.c')
-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 f599b7e..e6eb11a 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;