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
This commit is contained in:
Jordan Henderson 2020-04-27 19:48:03 -05:00
commit 9e82926bb9

View File

@ -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 {