tony2001 Fri May 18 20:34:13 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/standard file.c
Log:
fix leak and check for < 0 only of the 5th arg was passed
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/file.c?r1=1.409.2.6.2.18&r2=1.409.2.6.2.19&diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.409.2.6.2.18
php-src/ext/standard/file.c:1.409.2.6.2.19
--- php-src/ext/standard/file.c:1.409.2.6.2.18 Fri May 18 12:06:44 2007
+++ php-src/ext/standard/file.c Fri May 18 20:34:13 2007
@@ -21,7 +21,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: file.c,v 1.409.2.6.2.18 2007/05/18 12:06:44 tony2001 Exp $ */
+/* $Id: file.c,v 1.409.2.6.2.19 2007/05/18 20:34:13 tony2001 Exp $ */
/* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
@@ -536,6 +536,11 @@
return;
}
+ if (ZEND_NUM_ARGS() == 5 && maxlen < 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "length must be
greater than or equal to zero");
+ RETURN_FALSE;
+ }
+
context = php_stream_context_from_zval(zcontext, 0);
stream = php_stream_open_wrapper_ex(filename, "rb",
@@ -545,11 +550,6 @@
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);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php