com php-src: deflate_add(): Don't add unnecessa ry +1 to size: ext/zlib/zlib.c
| From: | Nikita Popov | Date: | Sun, 08 Jan 2017 12:47:20 +0000 |
| Subject: | com php-src: deflate_add(): Don't add unnecessa ry +1 to size: ext/zlib/zlib.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-96625@lists.php.net to get a copy of this message | ||
Commit: b36f4ac7089a05682081385cb4e6c1051cba9bc1
Author: Nikita Popov <nikic@php.net> Sun, 8 Jan 2017 13:47:20 +0100
Parents: ec1b7b933d630cd02e3998a211eda40a9e4e7ce3
Branches: PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b36f4ac7089a05682081385cb4e6c1051cba9bc1
Log:
deflate_add(): Don't add unnecessary +1 to size
zend_string_realloc will do this by itself.
Changed paths:
M ext/zlib/zlib.c
Diff:
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index c90c109..5c558ea 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -1171,8 +1171,7 @@ PHP_FUNCTION(deflate_add)
if (ctx->avail_out == 0) {
/* more output buffer space needed; realloc and try again */
/* adding 64 more bytes solved every issue I have seen */
- /* the + 1 is for the string terminator added below */
- out = zend_string_realloc(out, ZSTR_LEN(out) + 64 + 1, 0);
+ out = zend_string_realloc(out, ZSTR_LEN(out) + 64, 0);
ctx->avail_out = 64;
ctx->next_out = (Bytef *) ZSTR_VAL(out) + buffer_used;
}