iliaa Mon Mar 13 14:37:32 2006 UTC
Modified files:
/php-src/ext/standard string.c
Log:
MFB51: Added overflow checks to wordwrap() function.
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/string.c?r1=1.525&r2=1.526&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.525 php-src/ext/standard/string.c:1.526
--- php-src/ext/standard/string.c:1.525 Wed Mar 8 00:43:28 2006
+++ php-src/ext/standard/string.c Mon Mar 13 14:37:32 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.525 2006/03/08 00:43:28 pajoye Exp $ */
+/* $Id: string.c,v 1.526 2006/03/13 14:37:32 iliaa Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -866,12 +866,13 @@
/* 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;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php