Bug 11531 - tar: archive with first member named BZh[1-9] is not handled correctly
Summary: tar: archive with first member named BZh[1-9] is not handled correctly
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: 1.33.x
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-11-26 18:00 UTC by Michał Górny
Modified: 2018-11-27 10:27 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michał Górny 2018-11-26 18:00:36 UTC
If the first .tar member is named BZh[1-9], the archive is incorrectly recognized as bzip2-compressed:

$ busybox tar -xf ustar.tar 
tar: bunzip error -2
tar: short read

While such a filename is not very likely, it's a technically valid tarball.

To reproduce:
$ echo test > BZh5
$ tar -cf ustar.tar BZh5
Comment 1 Denys Vlasenko 2018-11-27 10:27:42 UTC
Fixed in git:

commit f4fc303e3679e4ab0d45f60c31f9b687f27f7452 (HEAD -> master)
Date:   Tue Nov 27 11:26:48 2018 +0100

    tar: fix too eager autodetection