]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix mutual check in tar sparse handling 1541/head
authorSamanta Navarro <ferivoz@riseup.net>
Tue, 1 Jun 2021 11:26:30 +0000 (11:26 +0000)
committerSamanta Navarro <ferivoz@riseup.net>
Tue, 1 Jun 2021 11:26:45 +0000 (11:26 +0000)
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

index 96d8101844fb59279a948ae87d3d7d8dd84708c3..9a32562dc711c2f71e19e3fb226dec072702d95b 100644 (file)
@@ -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)