diff options
author | Antony Dovgal <tony2001@php.net> | 2007-05-29 20:48:38 +0000 |
---|---|---|
committer | Antony Dovgal <tony2001@php.net> | 2007-05-29 20:48:38 +0000 |
commit | 7b5215d83ac9b79e41b8b21f60814ea626670a79 (patch) | |
tree | 347afaeafd72cd3cceff2e92279caac23c345316 | |
parent | 859b4e8d2faf53deb5577f3b4261507c1a0e8de0 (diff) | |
download | php-git-7b5215d83ac9b79e41b8b21f60814ea626670a79.tar.gz |
fix #41516 (fgets() returns a line of text when length parameter is <= 0)
-rw-r--r-- | ext/standard/file.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c index 1f81380c29..89896dd7bc 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1138,6 +1138,11 @@ PHPAPI PHP_FUNCTION(fgets) RETURN_NULL(); } + if (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, fgets() should only return length-1 bytes. */ RETURN_FALSE; |