andrei Mon Oct 2 19:42:42 2006 UTC Modified files: (Branch: PHP_5_2) /php-src/ext/standard string.c Log: Fix invalid memory access in strrpos(). http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.19&r2=1.445.2.14.2.20&diff_format=u Index: php-src/ext/standard/string.c diff -u php-src/ext/standard/string.c:1.445.2.14.2.19 php-src/ext/standard/string.c:1.445.2.14.2.20 --- php-src/ext/standard/string.c:1.445.2.14.2.19 Thu Aug 31 14:21:21 2006 +++ php-src/ext/standard/string.c Mon Oct 2 19:42:42 2006 @@ -18,7 +18,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: string.c,v 1.445.2.14.2.19 2006/08/31 14:21:21 tony2001 Exp $ */ +/* $Id: string.c,v 1.445.2.14.2.20 2006/10/02 19:42:42 andrei Exp $ */ /* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */ @@ -1767,13 +1767,18 @@ } if (offset >= 0) { + if (offset > haystack_len) { + RETURN_FALSE; + } p = haystack + offset; e = haystack + haystack_len - needle_len; } else { - p = haystack; if (-offset > haystack_len) { - e = haystack - needle_len; - } else if (needle_len > -offset) { + RETURN_FALSE; + } + + p = haystack; + if (needle_len > -offset) { e = haystack + haystack_len - needle_len; } else { e = haystack + haystack_len + offset;
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php