]> granicus.if.org Git - php/commitdiff
deflate_add(): Don't add unnecessary +1 to size
authorNikita Popov <nikic@php.net>
Sun, 8 Jan 2017 12:47:20 +0000 (13:47 +0100)
committerNikita Popov <nikic@php.net>
Sun, 8 Jan 2017 12:47:20 +0000 (13:47 +0100)
zend_string_realloc will do this by itself.

ext/zlib/zlib.c

index c90c109b726423e37713b3e717ebd0069e34049e..5c558ea6a6d6fdb49954981c590b76dcd9dcc96e 100644 (file)
@@ -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;
                }