]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Only consume a second all-null record
authorKevin Locke <kevin@kevinlocke.name>
Sat, 11 Jan 2014 23:35:21 +0000 (16:35 -0700)
committerKevin Locke <kevin@kevinlocke.name>
Sat, 11 Jan 2014 23:35:21 +0000 (16:35 -0700)
Currently any record following an all-null record will be consumed.
This is probably not the intended behavior, as it does not match the
comment and consumes/ignores unexpected and unrecognized data.  In
particular, for the read_concatenated_archives case, it could
incorrectly consume a non-null header.

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
libarchive/archive_read_support_format_tar.c

index b39298a106e76fc988b4c5f23c539af4726d0a4c..70d2e12c2983b5d4d16d84b676f0fced24ab42a5 100644 (file)
@@ -651,7 +651,7 @@ tar_read_header(struct archive_read *a, struct tar *tar,
                /* Try to consume a second all-null record, as well. */
                tar_flush_unconsumed(a, unconsumed);
                h = __archive_read_ahead(a, 512, NULL);
-               if (h != NULL)
+               if (h != NULL && h[0] == 0 && archive_block_is_null(h))
                        __archive_read_consume(a, 512);
                archive_clear_error(&a->archive);
                if (a->archive.archive_format_name == NULL) {