cvs: php4 /ext/zlib zlib.c
| From: | Thies C. Arntzen | Date: | Wed, 11 Jul 2001 15:26:42 +0000 |
| Subject: | cvs: php4 /ext/zlib zlib.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-6186@lists.php.net to get a copy of this message | ||
thies Wed Jul 11 11:26:42 2001 EDT
Modified files:
/php4/ext/zlib zlib.c
Log:
gzencode() now zero-terminates its buffer.
Index: php4/ext/zlib/zlib.c
diff -u php4/ext/zlib/zlib.c:1.80 php4/ext/zlib/zlib.c:1.81
--- php4/ext/zlib/zlib.c:1.80 Wed Jun 6 09:05:53 2001
+++ php4/ext/zlib/zlib.c Wed Jul 11 11:26:42 2001
@@ -16,7 +16,7 @@
| Stefan Röhrich <sr@linux.de> |
+----------------------------------------------------------------------+
*/
-/* $Id: zlib.c,v 1.80 2001/06/06 13:05:53 rasmus Exp $ */
+/* $Id: zlib.c,v 1.81 2001/07/11 15:26:42 thies Exp $ */
#define IS_EXT_MODULE
#ifdef HAVE_CONFIG_H
@@ -994,7 +994,7 @@
int start_offset = (do_start?10:0);
int end_offset = (do_end?8:0);
- outlen = sizeof(char) * (str_length * 1.001 + 12);
+ outlen = sizeof(char) * (str_length * 1.001 + 12) + 1; /* leave some room for a trailing \0 */
if ((outlen+start_offset+end_offset) > *p_buffer_len) {
buffer = (Bytef *) emalloc(outlen+start_offset+end_offset);
} else {
@@ -1098,6 +1098,7 @@
trailer[5] = (char) (ZLIBG(stream).total_in >> 8) & 0xFF;
trailer[6] = (char) (ZLIBG(stream).total_in >> 16) & 0xFF;
trailer[7] = (char) (ZLIBG(stream).total_in >> 24) & 0xFF;
+ trailer[8] = '\0';
*new_length += 8;
}
deflateEnd(&ZLIBG(stream));