From e24fe395a2118efbb5456e5cce75988e4739d3bb Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Mon, 26 Jun 2006 23:22:58 +0000 Subject: [PATCH] MFH: zero-terminate strings produced with FORCE_DEFLATE --- ext/zlib/zlib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index d3932f41ad..e9bea6cf0f 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -820,6 +820,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 { -- 2.40.0