Fix mxmlSaveString with a 0-length buffer (Issue #284)

pull/288/head
Michael R Sweet 3 years ago
parent bd4eb861a7
commit 3a4ece2266
No known key found for this signature in database
GPG Key ID: 999559A027815955
  1. 1
      CHANGES.md
  2. 5
      mxml-file.c

@ -1,6 +1,7 @@
# Changes in Mini-XML 3.2.1
- Fixed potential memory leak in `mxmlLoad*` functions (Issue #278, Issue #279)
- Fixed `mxmlSaveString` with a buffer size of 0 (Issue #284)
- Fixed `MXML_MINOR_VERSION` value in "mxml.h" (Issue #285)
- Fixed POSIX threading support for MingW (Issue #287)
- Fixed some minor memory leaks found by Coverity.

@ -376,7 +376,10 @@ mxmlSaveString(mxml_node_t *node, /* I - Node to write */
*/
if (ptr[0] >= ptr[1])
buffer[bufsize - 1] = '\0';
{
if (bufsize > 0)
buffer[bufsize - 1] = '\0';
}
else
ptr[0][0] = '\0';

Loading…
Cancel
Save