From c440902e046fd6973c468aa47af1dc6af8e11879 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Sun, 21 Jan 2007 15:28:56 +0000 Subject: [PATCH] - Simplify dtor - Zero terminate meta data --- ext/phar/phar.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ext/phar/phar.c b/ext/phar/phar.c index 87844ddcc82..2130d3c6ccd 100644 --- a/ext/phar/phar.c +++ b/ext/phar/phar.c @@ -157,8 +157,7 @@ static void destroy_phar_manifest(void *pDest) /* {{{ */ php_stream_close(entry->temp_file); } if (entry->metadata) { - zval_dtor(entry->metadata); - efree(entry->metadata); + zval_ptr_dtor(&entry->metadata); entry->metadata = 0; } efree(entry->filename); @@ -397,12 +396,13 @@ static int phar_parse_metadata(php_stream *fp, char **buffer, char *endbuffer, z if the index already exists, convert to a sub-array */ PHAR_GET_32(*buffer, datatype); PHAR_GET_16(*buffer, len); - data = (char *) emalloc(len); + data = (char *) emalloc(len+1); if (endbuffer - *buffer < len) { efree(data); return FAILURE; } else { memcpy(data, *buffer, len); + data[len] = '\0'; } if (SUCCESS == zend_hash_index_find(metadata->value.ht, datatype, (void**)&found)) { if (Z_TYPE_P(found) == IS_ARRAY) {