]> 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 10:40:10 +0000 (19:40 +0900)
 - Do not consume read bytes more than the entry used when reading
   a uncompressed CAB file.

libarchive/archive_read_support_format_cab.c

index 1fe5c62f15c4148182545e82460d0317fbba6898..d8c9604f962165d70845e6546c31f29deb7d8196 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);
 }