Merge branch 'PHP-7.1' into PHP-7.2

* PHP-7.1:
  Fixed bug #75511 (fread not free unused buffer)
This commit is contained in:
Xinchen Hui 2017-11-13 11:13:42 +08:00
commit bc38c06752

View File

@ -1815,6 +1815,10 @@ PHPAPI PHP_FUNCTION(fread)
/* needed because recv/read/gzread doesnt put a null at the end*/
Z_STRVAL_P(return_value)[Z_STRLEN_P(return_value)] = 0;
if (len > Z_STRLEN_P(return_value) * 2) {
Z_STR_P(return_value) = zend_string_truncate(Z_STR_P(return_value), Z_STRLEN_P(return_value), 0);
}
}
/* }}} */