tony2001 Wed May 30 09:16:29 2007 UTC Modified files: /php-src/ext/standard file.c Log: check length only when it's specified add the same check to fgetss() http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.490&r2=1.491&diff_format=u Index: php-src/ext/standard/file.c diff -u php-src/ext/standard/file.c:1.490 php-src/ext/standard/file.c:1.491 --- php-src/ext/standard/file.c:1.490 Tue May 29 20:48:38 2007 +++ php-src/ext/standard/file.c Wed May 30 09:16:29 2007 @@ -21,7 +21,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: file.c,v 1.490 2007/05/29 20:48:38 tony2001 Exp $ */ +/* $Id: file.c,v 1.491 2007/05/30 09:16:29 tony2001 Exp $ */ /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */ @@ -1135,10 +1135,10 @@ size_t retlen = 0; if (zend_parse_parameters(argc TSRMLS_CC, "r|l", &zstream, &length) == FAILURE) { - RETURN_NULL(); + return; } - if (length <= 0) { + if (ZEND_NUM_ARGS() == 2 && length <= 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0"); RETURN_FALSE; } @@ -1210,6 +1210,11 @@ return; } + if (ZEND_NUM_ARGS() >= 2 && 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, fgetss() 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