tony2001 Tue May 29 20:48:38 2007 UTC
Modified files:
/php-src/ext/standard file.c
Log:
fix #41516 (fgets() returns a line of text when length parameter is <= 0)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.489&r2=1.490&diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.489 php-src/ext/standard/file.c:1.490
--- php-src/ext/standard/file.c:1.489 Fri May 18 20:34:07 2007
+++ php-src/ext/standard/file.c Tue May 29 20:48:38 2007
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.489 2007/05/18 20:34:07 tony2001 Exp $ */
+/* $Id: file.c,v 1.490 2007/05/29 20:48:38 tony2001 Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -1138,6 +1138,11 @@
RETURN_NULL();
}
+ if (length <= 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter
must be greater than 0");
+ RETURN_FALSE;
+ }
+
if (length == 1) {
/* For BC reasons, fgets() should only return length-1 bytes. */
RETURN_FALSE;
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php