hirokawa Sat Feb 16 10:43:57 2008 UTC Modified files: (Branch: PHP_5_3) /php-src/ext/mbstring mbstring.c Log: fixed #43841 mb_strrpos offset is byte count for negative values. http://cvs.php.net/viewvc.cgi/php-src/ext/mbstring/mbstring.c?r1=1.224.2.22.2.25.2.6&r2=1.224.2.22.2.25.2.7&diff_format=u Index: php-src/ext/mbstring/mbstring.c diff -u php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.6 php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.7 --- php-src/ext/mbstring/mbstring.c:1.224.2.22.2.25.2.6 Sat Feb 16 08:58:00 2008 +++ php-src/ext/mbstring/mbstring.c Sat Feb 16 10:43:57 2008 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: mbstring.c,v 1.224.2.22.2.25.2.6 2008/02/16 08:58:00 hirokawa Exp $ */ +/* $Id: mbstring.c,v 1.224.2.22.2.25.2.7 2008/02/16 10:43:57 hirokawa Exp $ */ /* * PHP 4 Multibyte String module "mbstring" @@ -1726,6 +1726,13 @@ if (needle.len <= 0) { RETURN_FALSE; } + + if ((offset > 0 && offset > mbfl_strlen(&haystack)) || + (offset < 0 && -offset > mbfl_strlen(&haystack))) { + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Offset is greater than the length of haystack string"); + RETURN_FALSE; + } + n = mbfl_strpos(&haystack, &needle, offset, 1); if (n >= 0) { RETVAL_LONG(n);
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php