Skip to content

Commit bc38c06

Browse files
committed
Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1: Fixed bug #75511 (fread not free unused buffer)
2 parents 1426be1 + 1c1df0d commit bc38c06

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

ext/standard/file.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1815,6 +1815,10 @@ PHPAPI PHP_FUNCTION(fread)
18151815

18161816
/* needed because recv/read/gzread doesnt put a null at the end*/
18171817
Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;
1818+
1819+
if (len > Z_STRLEN_P(return_value) * 2) {
1820+
Z_STR_P(return_value) = zend_string_truncate(Z_STR_P(return_value), Z_STRLEN_P(return_value), 0);
1821+
}
18181822
}
18191823
/* }}} */
18201824

0 commit comments

Comments
 (0)