]> granicus.if.org Git - php/commitdiff
null terminate the returned string in here too.
authorfoobar <sniper@php.net>
Sat, 18 Aug 2001 23:43:04 +0000 (23:43 +0000)
committerfoobar <sniper@php.net>
Sat, 18 Aug 2001 23:43:04 +0000 (23:43 +0000)
ext/xml/xml.c

index a7e25ae2ea982e38867712885218f559794acf8c..7c187223e4d60b21b4da60cc63d28f85d44f9074 100644 (file)
@@ -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