summaryrefslogtreecommitdiff
path: root/ext/phar/tar.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/phar/tar.c')
-rw-r--r--ext/phar/tar.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/phar/tar.c b/ext/phar/tar.c
index 56b2a0eedf..844c6b5419 100644
--- a/ext/phar/tar.c
+++ b/ext/phar/tar.c
@@ -255,6 +255,12 @@ int phar_parse_tarfile(php_stream* fp, char *fname, int fname_len, char *alias,
size = entry.uncompressed_filesize = entry.compressed_filesize =
phar_tar_number(hdr->size, sizeof(hdr->size));
+ /* skip global/file headers (pax) */
+ if (!old && (hdr->typeflag == TAR_GLOBAL_HDR || hdr->typeflag == TAR_FILE_HDR)) {
+ size = (size+511)&~511;
+ goto next;
+ }
+
if (((!old && hdr->prefix[0] == 0) || old) && strlen(hdr->name) == sizeof(".phar/signature.bin")-1 && !strncmp(hdr->name, ".phar/signature.bin", sizeof(".phar/signature.bin")-1)) {
off_t curloc;
@@ -548,6 +554,7 @@ bail:
size = (size+511)&~511;
if (((hdr->typeflag == '\0') || (hdr->typeflag == TAR_FILE)) && size > 0) {
+next:
/* this is not good enough - seek succeeds even on truncated tars */
php_stream_seek(fp, size, SEEK_CUR);
if ((uint)php_stream_tell(fp) > totalsize) {