Skip to content

Commit 12d74cf

Browse files
committed
Ignore size of directories with regular type
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.
1 parent 3aeea1e commit 12d74cf

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

libarchive/archive_read_support_format_tar.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,11 +573,15 @@ archive_read_format_tar_read_header(struct archive_read *a,
573573
l = wcslen(wp);
574574
if (l > 0 && wp[l - 1] == L'/') {
575575
archive_entry_set_filetype(entry, AE_IFDIR);
576+
tar->entry_bytes_remaining = 0;
577+
tar->entry_padding = 0;
576578
}
577579
} else if ((p = archive_entry_pathname(entry)) != NULL) {
578580
l = strlen(p);
579581
if (l > 0 && p[l - 1] == '/') {
580582
archive_entry_set_filetype(entry, AE_IFDIR);
583+
tar->entry_bytes_remaining = 0;
584+
tar->entry_padding = 0;
581585
}
582586
}
583587
}

0 commit comments

Comments
 (0)