]> granicus.if.org Git - php/commitdiff
size_t is unsigned and can't be negative
authorDmitry Stogov <dmitry@zend.com>
Fri, 29 Apr 2016 09:23:30 +0000 (12:23 +0300)
committerDmitry Stogov <dmitry@zend.com>
Fri, 29 Apr 2016 09:23:30 +0000 (12:23 +0300)
ext/spl/spl_directory.c

index 412fc543242ccd4dd5a2f871f6cc47d8b01827e6..161fd12268c69c7b36e7d3635be8984e09300c9a 100644 (file)
@@ -2884,7 +2884,7 @@ SPL_METHOD(SplFileObject, fwrite)
 
        if (ZEND_NUM_ARGS() > 1) {
                if (length >= 0) {
-                       str_len = MAX(0, MIN((size_t)length, str_len));
+                       str_len = MIN((size_t)length, str_len);
                } else {
                        /* Negative length given, nothing to write */
                        str_len = 0;