]> granicus.if.org Git - php/commitdiff
MFH: zero-terminate strings produced with FORCE_DEFLATE
authorAntony Dovgal <tony2001@php.net>
Mon, 26 Jun 2006 23:22:58 +0000 (23:22 +0000)
committerAntony Dovgal <tony2001@php.net>
Mon, 26 Jun 2006 23:22:58 +0000 (23:22 +0000)
ext/zlib/zlib.c

index d3932f41adaa8ebff55dc3aecc4f5a9cca137b9b..e9bea6cf0fd4413821f67ecdeffb0af07381d24d 100644 (file)
@@ -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 {