cvs: php-src(PHP_5_2) /ext/standard string.c
| From: | Ilia Alshanetsky | Date: | Thu, 08 Mar 2007 00:18:11 +0000 |
| Subject: | cvs: php-src(PHP_5_2) /ext/standard string.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-43457@lists.php.net to get a copy of this message | ||
iliaa Thu Mar 8 00:18:11 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/standard string.c
Log:
Improved length parameter validation
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/string.c?r1=1.445.2.14.2.47&r2=1.445.2.14.2.48&diff_format=u
Index: php-src/ext/standard/string.c
diff -u php-src/ext/standard/string.c:1.445.2.14.2.47 php-src/ext/standard/string.c:1.445.2.14.2.48
--- php-src/ext/standard/string.c:1.445.2.14.2.47 Thu Mar 8 00:06:41 2007
+++ php-src/ext/standard/string.c Thu Mar 8 00:18:10 2007
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.445.2.14.2.47 2007/03/08 00:06:41 iliaa Exp $ */
+/* $Id: string.c,v 1.445.2.14.2.48 2007/03/08 00:18:10 iliaa Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -4655,7 +4655,7 @@
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length should be greater than 0.");
RETURN_FALSE;
}
- if ((p + Z_LVAL_PP(length)) > endp) {
+ if ((p + Z_LVAL_PP(length)) <= p || (p + Z_LVAL_PP(length)) > endp) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length value %ld exceeds string
length.", Z_LVAL_PP(length));
RETURN_FALSE;
}