diff options
author | Jordan Henderson <jhenderson@hdfgroup.org> | 2020-04-27 23:57:36 (GMT) |
---|---|---|
committer | David Young <dyoung@hdfgroup.org> | 2020-05-20 14:37:20 (GMT) |
commit | 3454833bf7b48d96ec4c30f3a257398f4b1a6faf (patch) | |
tree | b180621a99d6d29867d9737b4ef6af53441e1632 /tools | |
parent | aa30bd054d6aaee8c2a2a1a058a20bfe107659cf (diff) | |
download | hdf5-3454833bf7b48d96ec4c30f3a257398f4b1a6faf.zip hdf5-3454833bf7b48d96ec4c30f3a257398f4b1a6faf.tar.gz hdf5-3454833bf7b48d96ec4c30f3a257398f4b1a6faf.tar.bz2 |
Fix memory error in h5dump xml 'escape the string' routine
Diffstat (limited to 'tools')
-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 b24c005..1f6e320 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 { |