Fixed zip archiver: could do bogus seek if a small, non-zip file got put
authorRyan C. Gordon <icculus@icculus.org>
Sat, 05 May 2007 05:52:43 +0000
changeset 895 8bf07c014a43
parent 894 6d152b4900ea
child 897 4adcb2c5567b
Fixed zip archiver: could do bogus seek if a small, non-zip file got put through isArchive().
CHANGELOG.txt
archivers/zip.c
--- a/CHANGELOG.txt	Sun Apr 29 08:16:30 2007 +0000
+++ b/CHANGELOG.txt	Sat May 05 05:52:43 2007 +0000
@@ -2,6 +2,8 @@
  * CHANGELOG.
  */
 
+05052007 - Fixed zip archiver: could do bogus seek if a small, non-zip file
+           got put through isArchive().
 04292007 - Minor const correctness tweak in zip archiver.
 04032007 - Added a "make dist" target for packing up source code releases.
            Reverted Unix recursive mutex code. There were some portability
--- a/archivers/zip.c	Sun Apr 29 08:16:30 2007 +0000
+++ b/archivers/zip.c	Sat May 05 05:52:43 2007 +0000
@@ -447,6 +447,8 @@
             break;
 
         filepos -= (maxread - 4);
+        if (filepos < 0)
+            filepos = 0;
     } /* while */
 
     BAIL_IF_MACRO(!found, ERR_NOT_AN_ARCHIVE, -1);