// 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))
*/
qfile_t* FS_Open (const char* filepath, const char* mode, qboolean quiet, qboolean nonblocking)
{
-#ifdef FS_FIX_PATHS
- char fixedFileName[MAX_QPATH];
- char *d;
- strlcpy( fixedFileName, filepath, MAX_QPATH );
- // try to fix common mistakes (\ instead of /)
- for( d = fixedFileName ; *d ; d++ )
- if( *d == '\\' )
- *d = '/';
- filepath = fixedFileName;
-#endif
-
if (FS_CheckNastyPath(filepath, false))
{
Con_Printf("FS_Open(\"%s\", \"%s\", %s): nasty filename rejected\n", filepath, mode, quiet ? "true" : "false");
// copy everything up except nextseperator
strlcpy(subpattern, pattern, min(sizeof(subpattern), (size_t) (nextseparator - pattern + 1)));
// find the last '/' before the wildcard
- prevseparator = strrchr( subpattern, '/' ) + 1;
+ prevseparator = strrchr( subpattern, '/' );
if (!prevseparator)
- {
prevseparator = subpattern;
- }
+ else
+ prevseparator++;
// copy everything from start to the previous including the '/' (before the wildcard)
// everything up to start is already included in the path of matchedSet's entries
strlcpy(subpath, start, min(sizeof(subpath), (size_t) ((prevseparator - subpattern) - (start - pattern) + 1)));