summaryrefslogtreecommitdiff
path: root/ext/phar/phar.c
diff options
context:
space:
mode:
authorGreg Beaver <cellog@php.net>2008-10-26 05:49:09 +0000
committerGreg Beaver <cellog@php.net>2008-10-26 05:49:09 +0000
commit86f8d0a8e9cbb4b604690f7bb0f58e6ae7df890c (patch)
tree15ca0d51303b4868598c25af25c14ea1ea82969e /ext/phar/phar.c
parent5153c1971402a70f928abf41a6ae12144b61d79b (diff)
downloadphp-git-86f8d0a8e9cbb4b604690f7bb0f58e6ae7df890c.tar.gz
fix several errors found by valgrind
1 - entry metadata not properly processed or retrieved from cached phars 2 - copy on write was using a void return value instead of int, a dangerous oversight in phar_update_cached_entry 3 - metadata creation in entries for cached phars was causing an invalid read
Diffstat (limited to 'ext/phar/phar.c')
-rw-r--r--ext/phar/phar.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index 31efbcab33..45c999a5af 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -1114,7 +1114,9 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
}
if (entry.is_persistent) {
- if (phar_parse_metadata(&buffer, &entry.metadata, 0 TSRMLS_CC) == FAILURE) {
+ PHAR_GET_32(buffer, entry.metadata_len);
+ if (!entry.metadata_len) buffer -= 4;
+ if (phar_parse_metadata(&buffer, &entry.metadata, entry.metadata_len TSRMLS_CC) == FAILURE) {
pefree(entry.filename, entry.is_persistent);
MAPPHAR_FAIL("unable to read file metadata in .phar file \"%s\"");
}