From: foobar Date: Sat, 18 Aug 2001 23:43:04 +0000 (+0000) Subject: null terminate the returned string in here too. X-Git-Tag: PRE_SUBST_Z_MACROS~450 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c902ad74f0ef5edc2b780e087ef419acba5d15b6;p=php null terminate the returned string in here too. --- 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