From: Marcus Boerger Date: Mon, 7 Mar 2005 21:54:08 +0000 (+0000) Subject: - Length needs to be positive X-Git-Tag: RELEASE_0_3~40 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cf6711abfa62cf3494eb9bafa2632b28d438b689;p=php - Length needs to be positive --- diff --git a/ext/standard/file.c b/ext/standard/file.c index a64242ec1c..7d8fd5ceac 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1229,7 +1229,7 @@ PHPAPI PHP_FUNCTION(fwrite) } convert_to_string_ex(arg2); convert_to_long_ex(arg3); - num_bytes = MIN(Z_LVAL_PP(arg3), Z_STRLEN_PP(arg2)); + num_bytes = MAX(0, MIN(Z_LVAL_PP(arg3), Z_STRLEN_PP(arg2))); break; default: