]> granicus.if.org Git - php/commitdiff
MFH: fix #41430 (Fatal error with negative values of maxlen parameter of file_get_con...
authorAntony Dovgal <tony2001@php.net>
Fri, 18 May 2007 12:06:44 +0000 (12:06 +0000)
committerAntony Dovgal <tony2001@php.net>
Fri, 18 May 2007 12:06:44 +0000 (12:06 +0000)
NEWS
ext/standard/file.c

diff --git a/NEWS b/NEWS
index 705cb2bd542ccc3753db5da7ac97e13dba74f0ad..24bc28fb6b8117467ba49e4585c046b821a09091 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,8 @@ PHP                                                                        NEWS
 - Fixed altering $this via argument named "this". (Dmitry)
 - Fixed PHP CLI to use the php.ini from the binary location. (Hannes)
 - Fixed segfault in strripos(). (Tony, Joxean Koret)
+- Fixed bug #41430 (Fatal error with negative values of maxlen parameter of 
+  file_get_contents()). (Tony)
 - Fixed bug #41421 (Uncaught exception from a stream wrapper segfaults). 
   (Tony, Dmitry)
 - Fixed bug #41403 (json_decode cannot decode floats if localeconv 
index 993842e17aa2574f8322bb696bfbc09a14a34886..1b61f17804b9ffc8f0ea37f07ebe31fa2bbee866 100644 (file)
@@ -545,6 +545,11 @@ PHP_FUNCTION(file_get_contents)
                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);