diff options
author | Xinchen Hui <laruence@gmail.com> | 2017-11-13 11:19:46 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2017-11-13 11:19:46 +0800 |
commit | 70ee6688de38e5715534f01eb09fc9ea044ae9c9 (patch) | |
tree | a8c271a34d06084e8cda10d9b3edae26eb47478d /ext/standard/file.c | |
parent | 46a21c5173c7d2162cfa09e8698fb180a203bdfa (diff) | |
parent | 2d88b2a1ea52bb86b6a95dfef95df8be61416023 (diff) | |
download | php-git-70ee6688de38e5715534f01eb09fc9ea044ae9c9.tar.gz |
Merge branch 'PHP-7.2'
* PHP-7.2:
Avoid overflow
Diffstat (limited to 'ext/standard/file.c')
-rw-r--r-- | ext/standard/file.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c index e8d7942461..5a2f9ccadc 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -1816,7 +1816,7 @@ 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) { + if (Z_STRLEN_P(return_value) < len / 2) { Z_STR_P(return_value) = zend_string_truncate(Z_STR_P(return_value), Z_STRLEN_P(return_value), 0); } } |