summaryrefslogtreecommitdiff
path: root/libarchive/archive_read_support_format_tar.c
diff options
context:
space:
mode:
authorKevin Locke <kevin@kevinlocke.name>2014-01-11 16:35:21 -0700
committerKevin Locke <kevin@kevinlocke.name>2014-01-11 16:35:21 -0700
commita6c076b1c844f41d471c06da1db770efe5518e20 (patch)
treee3bfd93d8bb2cdfb6d3bb53b93bf5b165fa90fb1 /libarchive/archive_read_support_format_tar.c
parentb45c3ae1825c8cedc7cde2972a04974f73b08315 (diff)
downloadlibarchive-a6c076b1c844f41d471c06da1db770efe5518e20.tar.gz
Only consume a second all-null record
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>
Diffstat (limited to 'libarchive/archive_read_support_format_tar.c')
-rw-r--r--libarchive/archive_read_support_format_tar.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libarchive/archive_read_support_format_tar.c b/libarchive/archive_read_support_format_tar.c
index b39298a1..70d2e12c 100644
--- a/libarchive/archive_read_support_format_tar.c
+++ b/libarchive/archive_read_support_format_tar.c
@@ -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) {