summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-05-18 12:06:44 +0000
committerAntony Dovgal <tony2001@php.net>2007-05-18 12:06:44 +0000
commit6d41d020dfd2f84618357909232007c6ab3451f1 (patch)
tree0f9010259881a4a0b008564bd893acc2c0c62df8 /ext
parent4167b0a4ce98d2eaaa08563105c7c7d0a54930e9 (diff)
downloadphp-git-6d41d020dfd2f84618357909232007c6ab3451f1.tar.gz
MFH: fix #41430 (Fatal error with negative values of maxlen parameter of file_get_contents())
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/file.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 993842e17a..1b61f17804 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -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);