]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Ignore size of directories with regular type
authorSamanta Navarro <ferivoz@riseup.net>
Sat, 28 Aug 2021 11:53:24 +0000 (11:53 +0000)
committerSamanta Navarro <ferivoz@riseup.net>
Sat, 4 Sep 2021 11:56:30 +0000 (11:56 +0000)
In old tar formats directories are specified by appending a slash to
their names.

Directories may have sizes, but they do not have data blocks. Keep this
in mind and avoid skipping data blocks when encountering directories.

libarchive/archive_read_support_format_tar.c

index 7e8febacf68607fd8298234000a02651da89457e..18bdd9f07b871adfe966593a8eddd5a42f7b3876 100644 (file)
@@ -573,11 +573,15 @@ archive_read_format_tar_read_header(struct archive_read *a,
                        l = wcslen(wp);
                        if (l > 0 && wp[l - 1] == L'/') {
                                archive_entry_set_filetype(entry, AE_IFDIR);
+                               tar->entry_bytes_remaining = 0;
+                               tar->entry_padding = 0;
                        }
                } else if ((p = archive_entry_pathname(entry)) != NULL) {
                        l = strlen(p);
                        if (l > 0 && p[l - 1] == '/') {
                                archive_entry_set_filetype(entry, AE_IFDIR);
+                               tar->entry_bytes_remaining = 0;
+                               tar->entry_padding = 0;
                        }
                }
        }