summaryrefslogtreecommitdiff
path: root/ext/xml/xml.c
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2001-08-18 23:43:04 +0000
committerfoobar <sniper@php.net>2001-08-18 23:43:04 +0000
commitc902ad74f0ef5edc2b780e087ef419acba5d15b6 (patch)
tree569a3f230f922eb7fdc3e5f9a0e91ab05b2e28e2 /ext/xml/xml.c
parent1ffbcc5ecff5109bcfed38a8a750d6bb90ebdc5c (diff)
downloadphp-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.c3
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