summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2004-01-02 00:57:23 +0000
committerIlia Alshanetsky <iliaa@php.net>2004-01-02 00:57:23 +0000
commit6f7fe1dfa05bc3d23574de48d12badd2f46ee89e (patch)
tree8dca3a2103f2f75fa1d475fe2e7427b24a69cf18 /ext
parent6bfa0147487f70d346ea713f561346a4f10ce622 (diff)
downloadphp-git-6f7fe1dfa05bc3d23574de48d12badd2f46ee89e.tar.gz
Fixed bug #26752 (Silent unterminated loop when length parameter for
fgets(), fread() and fgetss() is 0).
Diffstat (limited to 'ext')
-rw-r--r--ext/standard/file.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 27c2455851..582023c30a 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -919,8 +919,8 @@ PHPAPI PHP_FUNCTION(fgets)
convert_to_long_ex(arg2);
len = Z_LVAL_PP(arg2);
- if (len < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter may not be negative");
+ if (len <= 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater then 0.");
RETURN_FALSE;
}
@@ -1026,8 +1026,8 @@ PHPAPI PHP_FUNCTION(fgetss)
if (bytes != NULL) {
convert_to_long_ex(bytes);
- if (Z_LVAL_PP(bytes) < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter may not be negative");
+ if (Z_LVAL_PP(bytes) <= 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater then 0.");
RETURN_FALSE;
}
@@ -1640,8 +1640,8 @@ PHPAPI PHP_FUNCTION(fread)
convert_to_long_ex(arg2);
len = Z_LVAL_PP(arg2);
- if (len < 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter may not be negative");
+ if (len <= 0) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater then 0.");
RETURN_FALSE;
}