diff options
author | foobar <sniper@php.net> | 2001-08-18 23:43:04 +0000 |
---|---|---|
committer | foobar <sniper@php.net> | 2001-08-18 23:43:04 +0000 |
commit | c902ad74f0ef5edc2b780e087ef419acba5d15b6 (patch) | |
tree | 569a3f230f922eb7fdc3e5f9a0e91ab05b2e28e2 /ext/xml/xml.c | |
parent | 1ffbcc5ecff5109bcfed38a8a750d6bb90ebdc5c (diff) | |
download | php-git-c902ad74f0ef5edc2b780e087ef419acba5d15b6.tar.gz |
null terminate the returned string in here too.
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 |