]> granicus.if.org Git - php/commitdiff
- Length needs to be positive
authorMarcus Boerger <helly@php.net>
Mon, 7 Mar 2005 21:54:08 +0000 (21:54 +0000)
committerMarcus Boerger <helly@php.net>
Mon, 7 Mar 2005 21:54:08 +0000 (21:54 +0000)
ext/standard/file.c

index a64242ec1cf3494e0fe6e3f4ef87fd9a44274c20..7d8fd5ceacd82632fd787bf42ee6d275e2f338ed 100644 (file)
@@ -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: