summaryrefslogtreecommitdiff
path: root/ext/xml/xml.c
diff options
context:
space:
mode:
authorStanislav Malyshev <stas@php.net>2016-09-01 23:15:34 -0700
committerFerenc Kovacs <tyra3l@gmail.com>2016-09-15 10:02:42 +0200
commit120eb29bb350950213bbc9a0e11345ba20b63db0 (patch)
tree167ece27f737dec7eb6e88505ecd020954b96436 /ext/xml/xml.c
parent88d26623b2e55becc1d4b3e7944ebb1a0c1bd908 (diff)
downloadphp-git-120eb29bb350950213bbc9a0e11345ba20b63db0.tar.gz
Fix various int size overflows.
Add function for detection of string zvals with length that does not fit INT_MAX.
Diffstat (limited to 'ext/xml/xml.c')
-rw-r--r--ext/xml/xml.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/xml/xml.c b/ext/xml/xml.c
index 5912f9143d..96a76efbdf 100644
--- a/ext/xml/xml.c
+++ b/ext/xml/xml.c
@@ -12,7 +12,7 @@
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
- | Authors: Stig Sæther Bakken <ssb@php.net> |
+ | Authors: Stig Sæther Bakken <ssb@php.net> |
| Thies C. Arntzen <thies@thieso.net> |
| Sterling Hughes <sterling@php.net> |
+----------------------------------------------------------------------+
@@ -638,7 +638,7 @@ PHPAPI char *xml_utf8_encode(const char *s, int len, int *newlen, const XML_Char
}
/* This is the theoretical max (will never get beyond len * 2 as long
* as we are converting from single-byte characters, though) */
- newbuf = safe_emalloc(len, 4, 1);
+ newbuf = safe_emalloc_string(len, 4, 1);
while (pos > 0) {
c = encoder ? encoder((unsigned char)(*s)) : (unsigned short)(*s);
if (c < 0x80) {