summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
Diffstat (limited to 'ext')
-rw-r--r--ext/zlib/zlib.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index e398c26a6e..089467018c 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -817,6 +817,8 @@ PHP_FUNCTION(gzencode)
trailer[6] = (char) (stream.total_in >> 16) & 0xFF;
trailer[7] = (char) (stream.total_in >> 24) & 0xFF;
trailer[8] = '\0';
+ } else {
+ s2[stream.total_out + GZIP_HEADER_LENGTH + (coding == CODING_GZIP ? GZIP_FOOTER_LENGTH : 0)] = '\0';
}
RETURN_STRINGL(s2, stream.total_out + GZIP_HEADER_LENGTH + (coding == CODING_GZIP ? GZIP_FOOTER_LENGTH : 0), 0);
} else {