tony2001                Fri May 18 20:34:07 2007 UTC

  Modified files:              
    /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.488&r2=1.489&diff_format=u
Index: php-src/ext/standard/file.c
diff -u php-src/ext/standard/file.c:1.488 php-src/ext/standard/file.c:1.489
--- php-src/ext/standard/file.c:1.488   Fri May 18 12:05:55 2007
+++ php-src/ext/standard/file.c Fri May 18 20:34:07 2007
@@ -21,7 +21,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: file.c,v 1.488 2007/05/18 12:05:55 tony2001 Exp $ */
+/* $Id: file.c,v 1.489 2007/05/18 20:34:07 tony2001 Exp $ */
 
 /* Synced with php 3.0 revision 1.218 1999-06-16 [ssb] */
 
@@ -554,6 +554,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);
        if (php_stream_path_param_encode(ppfilename, &filename, &filename_len, 
REPORT_ERRORS, context) == FAILURE) {
                RETURN_FALSE;
@@ -566,11 +571,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

Reply via email to