felipe Wed Nov 5 18:55:02 2008 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/standard string.c
Log:
- Fixed bug #45166 (substr() overflow changes) (now synced with other
branches)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.76&r2=1.445.2.14.2.77&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.76
php-src/ext/standard/string.c:1.445.2.14.2.77
--- php-src/ext/standard/string.c:1.445.2.14.2.76 Tue Jul 15 14:58:58 2008
+++ php-src/ext/standard/string.c Wed Nov 5 18:55:02 2008
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.445.2.14.2.76 2008/07/15 14:58:58 scottmac Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.77 2008/11/05 18:55:02 felipe Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -2260,8 +2260,10 @@
}
f = Z_LVAL_PP(from);
- if (f > Z_STRLEN_PP(str) || (f < 0 && -f > Z_STRLEN_PP(str))) {
+ if (f > Z_STRLEN_PP(str)) {
RETURN_FALSE;
+ } else if (f < 0 && -f > Z_STRLEN_PP(str)) {
+ f = 0;
}
if (l < 0 && (l + Z_STRLEN_PP(str) - f) < 0) {
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php