Merge pull request #10918 from andir/restrict-tarfile-formats

Restrict supported tarball formats to actual Tarballs
This commit is contained in:
Eelco Dolstra 2024-06-17 13:20:23 +02:00 committed by GitHub
commit 48d38b32d2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -79,7 +79,8 @@ TarArchive::TarArchive(Source & source, bool raw, std::optional<std::string> com
}
if (!raw) {
archive_read_support_format_all(archive);
archive_read_support_format_tar(archive);
archive_read_support_format_zip(archive);
} else {
archive_read_support_format_raw(archive);
archive_read_support_format_empty(archive);
@ -96,7 +97,8 @@ TarArchive::TarArchive(const Path & path)
, buffer(defaultBufferSize)
{
archive_read_support_filter_all(archive);
archive_read_support_format_all(archive);
archive_read_support_format_tar(archive);
archive_read_support_format_zip(archive);
archive_read_set_option(archive, NULL, "mac-ext", NULL);
check(archive_read_open_filename(archive, path.c_str(), 16384), "failed to open archive: %s");
}