summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJordan Henderson <jhenderson@hdfgroup.org>2020-04-28 00:48:03 (GMT)
committerJordan Henderson <jhenderson@hdfgroup.org>2020-04-28 00:48:03 (GMT)
commit9e82926bb91f20b2bf486f8a86d9de2b5364df2a (patch)
tree691c69c0e51ecd71c3e87db19228b56d05a631a5
parent4186e0d5bec8600aec966989dbfc1f24133ee385 (diff)
parent0644921cc207dda2551bf2893e12877b7bc0ec8c (diff)
downloadhdf5-9e82926bb91f20b2bf486f8a86d9de2b5364df2a.zip
hdf5-9e82926bb91f20b2bf486f8a86d9de2b5364df2a.tar.gz
hdf5-9e82926bb91f20b2bf486f8a86d9de2b5364df2a.tar.bz2
Merge pull request #2551 in HDFFV/hdf5 from ~JHENDERSON/hdf5:develop to develop
* commit '0644921cc207dda2551bf2893e12877b7bc0ec8c': Fix memory error in h5dump xml 'escape the string' routine
-rw-r--r--tools/src/h5dump/h5dump_xml.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index 07cff6a..95aff48 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -783,32 +783,30 @@ xml_escape_the_string(const char *str, int slen)
if (*cp == '\\') {
*ncp++ = '\\';
+ ncp_len--;
*ncp = *cp;
esc_len = 1;
}
else if (*cp == '\"') {
*ncp++ = '\\';
+ ncp_len--;
*ncp = *cp;
esc_len = 1;
}
else if (*cp == '\'') {
HDstrncpy(ncp, apos, ncp_len);
- ncp[ncp_len - 1] = '\0';
esc_len = HDstrlen(apos);
}
else if (*cp == '<') {
HDstrncpy(ncp, lt, ncp_len);
- ncp[ncp_len - 1] = '\0';
esc_len = HDstrlen(lt);
}
else if (*cp == '>') {
HDstrncpy(ncp, gt, ncp_len);
- ncp[ncp_len - 1] = '\0';
esc_len = HDstrlen(gt);
}
else if (*cp == '&') {
HDstrncpy(ncp, amp, ncp_len);
- ncp[ncp_len - 1] = '\0';
esc_len = HDstrlen(amp);
}
else {