diff options
Diffstat (limited to 'ext/xml/xml.c')
-rw-r--r-- | ext/xml/xml.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/xml/xml.c b/ext/xml/xml.c index a7e25ae2ea..7c187223e4 100644 --- a/ext/xml/xml.c +++ b/ext/xml/xml.c @@ -462,9 +462,10 @@ static XML_Char *xml_utf8_encode(const char *s, int len, int *newlen, const XML_ if (encoder == NULL) { /* If no encoder function was specified, return the data as-is. */ - newbuf = emalloc(len); + newbuf = emalloc(len + 1); memcpy(newbuf, s, len); *newlen = len; + newbuf[*newlen] = '\0'; return newbuf; } /* This is the theoretical max (will never get beyond len * 2 as long |