From 87afe3146302a32f195b184eb9dad689037be6c5 Mon Sep 17 00:00:00 2001 From: Samanta Navarro Date: Tue, 1 Jun 2021 11:26:30 +0000 Subject: [PATCH] Fix mutual check in tar sparse handling GNU.sparse.numbytes and GNU.sparse.offset both have to be set before gnu_add_sparse_entry can be called. The GNU.sparse.numbytes parser checks for tar->sparse_numbytes. This has to be tar->sparse_offset instead to work just like the GNU.sparse.offset parser. --- libarchive/archive_read_support_format_tar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libarchive/archive_read_support_format_tar.c b/libarchive/archive_read_support_format_tar.c index 96d810184..9a32562dc 100644 --- a/libarchive/archive_read_support_format_tar.c +++ b/libarchive/archive_read_support_format_tar.c @@ -1906,7 +1906,7 @@ pax_attribute(struct archive_read *a, struct tar *tar, } if (strcmp(key, "GNU.sparse.numbytes") == 0) { tar->sparse_numbytes = tar_atol10(value, strlen(value)); - if (tar->sparse_numbytes != -1) { + if (tar->sparse_offset != -1) { if (gnu_add_sparse_entry(a, tar, tar->sparse_offset, tar->sparse_numbytes) != ARCHIVE_OK) -- 2.47.2