diff options
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | lib/dpkg/tarfn.c | 23 | ||||
-rw-r--r-- | lib/dpkg/tarfn.h | 9 |
3 files changed, 33 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index 0cb18d8ed..f65ac0f9c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -51,6 +51,7 @@ dpkg (1.19.3) UNRELEASED; urgency=medium * libdpkg: Add proper tar error handling. This makes the tar extractor track and report back parse errors, so that we can give more descriptive messages. + * libdpkg: Detect unsupported tar entry types to give better error messages. * Perl modules: - Dpkg::Changelog::Debian: Preserve modelines at EOF. Closes: #916056 Thanks to Chris Lamb <lamby@debian.org> for initial test cases. diff --git a/lib/dpkg/tarfn.c b/lib/dpkg/tarfn.c index 8e3b6e545..afcce0ee5 100644 --- a/lib/dpkg/tarfn.c +++ b/lib/dpkg/tarfn.c @@ -530,6 +530,29 @@ tar_extractor(struct tar_archive *tar) case TAR_FILETYPE_GNU_LONGNAME: status = tar_gnu_long(tar, &h, &next_long_name); break; + case TAR_FILETYPE_GNU_VOLUME: + case TAR_FILETYPE_GNU_MULTIVOL: + case TAR_FILETYPE_GNU_SPARSE: + case TAR_FILETYPE_GNU_DUMPDIR: + status = dpkg_put_error(&tar->err, + _("unsupported GNU tar header type '%c'"), + h.type); + errno = 0; + break; + case TAR_FILETYPE_SOLARIS_EXTENDED: + case TAR_FILETYPE_SOLARIS_ACL: + status = dpkg_put_error(&tar->err, + _("unsupported Solaris tar header type '%c'"), + h.type); + errno = 0; + break; + case TAR_FILETYPE_PAX_GLOBAL: + case TAR_FILETYPE_PAX_EXTENDED: + status = dpkg_put_error(&tar->err, + _("unsupported PAX tar header type '%c'"), + h.type); + errno = 0; + break; default: status = dpkg_put_error(&tar->err, _("unknown tar header type '%c'"), diff --git a/lib/dpkg/tarfn.h b/lib/dpkg/tarfn.h index 06685a720..0302fb8a9 100644 --- a/lib/dpkg/tarfn.h +++ b/lib/dpkg/tarfn.h @@ -54,8 +54,17 @@ enum tar_filetype { TAR_FILETYPE_BLOCKDEV = '4', TAR_FILETYPE_DIR = '5', TAR_FILETYPE_FIFO = '6', + TAR_FILETYPE_CONTIG = '7', TAR_FILETYPE_GNU_LONGLINK = 'K', TAR_FILETYPE_GNU_LONGNAME = 'L', + TAR_FILETYPE_GNU_VOLUME = 'V', + TAR_FILETYPE_GNU_MULTIVOL = 'M', + TAR_FILETYPE_GNU_DUMPDIR = 'D', + TAR_FILETYPE_GNU_SPARSE = 'S', + TAR_FILETYPE_PAX_GLOBAL = 'g', + TAR_FILETYPE_PAX_EXTENDED = 'x', + TAR_FILETYPE_SOLARIS_EXTENDED = 'X', + TAR_FILETYPE_SOLARIS_ACL = 'A', }; struct tar_entry { |