]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Issue 76: Correct segfault when Zip bidder sees a file that is less than 128k
authorTim Kientzle <kientzle@gmail.com>
Sat, 13 Mar 2010 06:40:02 +0000 (01:40 -0500)
committerTim Kientzle <kientzle@gmail.com>
Sat, 13 Mar 2010 06:40:02 +0000 (01:40 -0500)
and starts with "MZ".  The "MZ" signature identifies executable files that
could be self-extracting Zip files; the Zip bidder incorrectly handled
end-of-file when searching ahead for the Zip contents.

Submitted by: dardoguidobono

SVN-Revision: 2028

libarchive/archive_read_support_format_zip.c

index 8f04b54288000083edb153000a69e615366c5068..49288ac075fd816b181c2cda6ccb8d2d8ed8fc19 100644 (file)
@@ -225,7 +225,7 @@ archive_read_format_zip_bid(struct archive_read *a)
                        /* Get 4k of data beyond where we stopped. */
                        buff = __archive_read_ahead(a, offset + 4096,
                            &bytes_avail);
-                       if (bytes_avail < offset + 1)
+                       if (buff == NULL)
                                break;
                        p = (const char *)buff + offset;
                        while (p + 9 < (const char *)buff + bytes_avail) {