]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
An additional fix of issue 249.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Tue, 20 Mar 2012 10:40:10 +0000 (19:40 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Tue, 20 Mar 2012 12:40:19 +0000 (21:40 +0900)
 - Do not consume read bytes more than the entry used when reading
   an uncompressed CAB file.

libarchive/archive_read_support_format_cab.c

index bc866a375b7d3f653696774d17e4205967f71822..81966c11110463719fb89481c7113e8c171b6647 100644 (file)
@@ -1932,6 +1932,11 @@ cab_read_data(struct archive_read *a, const void **buff,
        if (cab->entry_bytes_remaining == 0)
                cab->end_of_entry = 1;
        cab->entry_unconsumed = bytes_avail;
+       if (cab->entry_cffolder->comptype == COMPTYPE_NONE) {
+               /* Don't consume more than current entry used. */
+               if (cab->entry_cfdata->unconsumed > cab->entry_unconsumed)
+                       cab->entry_cfdata->unconsumed = cab->entry_unconsumed;
+       }
        return (ARCHIVE_OK);
 }