From e4c40ca7a2a5ea9ecf5b27d39de4b3541da47e09 Mon Sep 17 00:00:00 2001 From: havoc Date: Mon, 3 Mar 2008 13:25:38 +0000 Subject: [PATCH] fix support for zip archives made by the standard Mac OSX archiver (ignore bit 3 in the general flags - the fields ARE valid in the central directory, just not in the stream data) git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8187 d7cf8633-e32d-0410-b094-e92efae38249 --- fs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/fs.c b/fs.c index de596b4b..1eded56c 100644 --- a/fs.c +++ b/fs.c @@ -481,9 +481,16 @@ int PK3_BuildFileList (pack_t *pack, const pk3_endOfCentralDir_t *eocd) // Check encryption, compression, and attributes // 1st uint8 : general purpose bit flag // Check bits 0 (encryption), 3 (data descriptor after the file), and 5 (compressed patched data (?)) + // + // LordHavoc: bit 3 would be a problem if we were scanning the archive + // but is not a problem in the central directory where the values are + // always real. + // + // bit 3 seems to always be set by the standard Mac OSX zip maker + // // 2nd uint8 : external file attributes // Check bits 3 (file is a directory) and 5 (file is a volume (?)) - if ((ptr[8] & 0x29) == 0 && (ptr[38] & 0x18) == 0) + if ((ptr[8] & 0x21) == 0 && (ptr[38] & 0x18) == 0) { // Still enough bytes for the name? if (remaining < namesize || namesize >= (int)sizeof (*pack->files)) -- 2.39.2