summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2006-03-13 14:37:10 +0000
committerIlia Alshanetsky <iliaa@php.net>2006-03-13 14:37:10 +0000
commit80ea07d30c820f71eabdf31d47571d892e064df2 (patch)
tree3d6aa0e6d2516393ca92c6be0b2e6cc3066ce8ff
parentc69f100d0ec6630144f0dcaf0fa47a9a10a4abba (diff)
downloadphp-git-80ea07d30c820f71eabdf31d47571d892e064df2.tar.gz
Added overflow checks to wordwrap() function.
-rw-r--r--NEWS1
-rw-r--r--ext/standard/string.c3
2 files changed, 3 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index 0f77d95716..4f68751a54 100644
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,7 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? Mar 2006, PHP 5.1.3RC2
+- Added overflow checks to wordwrap() function. (Ilia)
- Removed the E_STRICT deprecation notice from "var". (Ilia)
- Fixed debug_zval_dump() to support private and protected members. (Dmitry)
- Fixed bug #36629 (SoapServer::handle() exits on SOAP faults). (Dmitry)
diff --git a/ext/standard/string.c b/ext/standard/string.c
index 5ae92eeec7..4f2897ce53 100644
--- a/ext/standard/string.c
+++ b/ext/standard/string.c
@@ -676,12 +676,13 @@ PHP_FUNCTION(wordwrap)
/* Multiple character line break or forced cut */
if (linelength > 0) {
chk = (int)(textlen/linelength + 1);
+ newtext = safe_emalloc(chk, breakcharlen, textlen + 1);
alloced = textlen + chk * breakcharlen + 1;
} else {
chk = textlen;
alloced = textlen * (breakcharlen + 1) + 1;
+ newtext = safe_emalloc(textlen, (breakcharlen + 1), 1);
}
- newtext = emalloc(alloced);
/* now keep track of the actual new text length */
newtextlen = 0;