]> granicus.if.org Git - php/commitdiff
Fixed bug #72505 (readfile() mangles files larger than 2G)
authorXinchen Hui <laruence@gmail.com>
Tue, 28 Jun 2016 03:11:25 +0000 (11:11 +0800)
committerXinchen Hui <laruence@gmail.com>
Fri, 16 Sep 2016 12:53:51 +0000 (20:53 +0800)
main/streams/streams.c

index f8581336bd6549a4b9c80a215e4e701dbeced545..4e00cd1be390fe2baf2823e89dd4c15c0afc4845 100644 (file)
@@ -1402,7 +1402,7 @@ PHPAPI size_t _php_stream_passthru(php_stream * stream STREAMS_DC TSRMLS_DC)
                if (p) {
                        do {
                                /* output functions return int, so pass in int max */
-                               if (0 < (b = PHPWRITE(p, MIN(mapped - bcount, INT_MAX)))) {
+                               if (0 < (b = PHPWRITE(p + bcount, MIN(mapped - bcount, INT_MAX)))) {
                                        bcount += b;
                                }
                        } while (b > 0 && mapped > bcount);