mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +02:00
Fixed bug #26752 (Silent unterminated loop when length parameter for
fgets(), fread() and fgetss() is 0).
This commit is contained in:
parent
6bfa014748
commit
6f7fe1dfa0
1 changed files with 6 additions and 6 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue