diff options
author | Jordan Henderson <jhenderson@hdfgroup.org> | 2020-04-27 23:57:36 (GMT) |
---|---|---|
committer | Jordan Henderson <jhenderson@hdfgroup.org> | 2020-04-27 23:57:36 (GMT) |
commit | 2442de3389b8a7892eb05ea0c30e7a91f58a7f38 (patch) | |
tree | 13b8d5e627bf237bd0ec73cfcdfb833a2a56a167 /tools/src | |
parent | 1a2668e13f8d7b78d104f7c6337a7b00879dfb3e (diff) | |
download | hdf5-2442de3389b8a7892eb05ea0c30e7a91f58a7f38.zip hdf5-2442de3389b8a7892eb05ea0c30e7a91f58a7f38.tar.gz hdf5-2442de3389b8a7892eb05ea0c30e7a91f58a7f38.tar.bz2 |
Fix memory error in h5dump xml 'escape the string' routine
Diffstat (limited to 'tools/src')
-rw-r--r-- | tools/src/h5dump/h5dump_xml.c | 6 |
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 { |