Skip to content
Browse files
From: Jorg Walter
Subject: Bug in zip archiver
Date: Sat, 23 Jul 2005 22:19:09 +0200


PhysFS has a bug in the ZIP archive module, function zip_find_start_of_dir.
Upon encountering a substring match, rc is set to a wrong value. The fix is
simple: swap both assignments like this:

[patch below  --Ed.]

Some additional info for testing: Symptoms when you encounter this bug: A dir
is reported as empty although it has files in it; prerequisites or
encountering it: two dirs, one a substring of another, like "data/txt" and
"data/txt2", laid out in a way so that variable "middle" points to a file in
txt2 at some point during zip_find_start_of_dir

By the way, if you're interested in where PhysFS is used: I found this bug
while writing a patch for DOSBox ( to support
ZIP files. And I'd love to see that enhanced PHYSFS_mount syntax in an
official release soon *hint* ;);)
  • Loading branch information
icculus committed Jul 23, 2005
1 parent 507b099 commit 8f3ab12d22243fc56389a2a1aa286bfabf15fc0d
Showing with 6 additions and 2 deletions.
  1. +1 −0 CHANGELOG
  2. +3 −0 CREDITS
  3. +2 −2 archivers/zip.c
@@ -2,6 +2,7 @@

07232005 - Fixed bug in zip archiver (thanks, J�rg Walter!).
07212005 - Patched to compile on OS/2 again.
07132005 - Updated zlib to 1.2.2, and patched it for this security hole:
@@ -87,6 +87,9 @@ MPW support:
Mingw support:
Matze Braun

Bug fixes:
J�rg Walter

Other stuff:
Your name here! Patches go to ...

@@ -1146,9 +1146,9 @@ static PHYSFS_sint32 zip_find_start_of_dir(ZIPinfo *info, const char *path,
if (rc == 0)
char ch = name[dlen];
if (ch < '/') /* make sure this isn't just a substr match. */
if ('/' < ch) /* make sure this isn't just a substr match. */
rc = -1;
else if (ch > '/')
else if ('/' > ch)
rc = 1;

0 comments on commit 8f3ab12

Please sign in to comment.