cvs: php-src /ext/standard file.c
| From: | Antony Dovgal | Date: | Fri, 18 May 2007 12:05:55 +0000 |
| Subject: | cvs: php-src /ext/standard file.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-44362@lists.php.net to get a copy of this message | ||
tony2001 Fri May 18 12:05:55 2007 UTC
Modified files:
/php-src/ext/standard file.c
Log:
fix #41430 (Fatal error with negative values of maxlen parameter of file_get_contents())
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.487&r2=1.488&diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.487 php-src/ext/standard/file.c:1.488
--- php-src/ext/standard/file.c:1.487 Mon Apr 16 09:43:52 2007
+++ php-src/ext/standard/file.c Fri May 18 12:05:55 2007
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.487 2007/04/16 09:43:52 dmitry Exp $ */
+/* $Id: file.c,v 1.488 2007/05/18 12:05:55 tony2001 Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -566,6 +566,11 @@
RETURN_FALSE;
}
+ if (maxlen < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length must be greater than or equal to
zero");
+ RETURN_FALSE;
+ }
+
if (offset > 0 && php_stream_seek(stream, offset, SEEK_SET) < 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to seek to position %ld in the
stream", offset);
php_stream_close(stream);