Broken tar applet

Denys Vlasenko vda.linux at googlemail.com
Sun Jan 3 22:40:56 UTC 2010


On Sunday 03 January 2010 17:17, haunschild__markus at web.de wrote:
> Hi,
> 
> the tar applet in the unstable master tree is somehow broken.
> 
> if you apply a "tar xzf openssl-0.9.8l.tar.gz"
> to the file: http://www.openssl.org/source/openssl-0.9.8l.tar.gz
> it gives an error:
> 
> invalid number '  14716'
> 
> This is only an example, as many other files don't work also.
> The 1.15.3 version can handle these files without problems.

Oh no, tar format strikes again.

The bug is here (shown already fixed):

        /* don't use xstrtoul, tar.chksum may have leading spaces */
        sum = strtoul(tar.chksum, NULL, 8);
        if (sum_u != sum IF_FEATURE_TAR_OLDSUN_COMPATIBILITY(&& sum_s != sum)) {
                bb_error_msg_and_die("invalid tar header checksum");
        }


and it exists in 1.15.3 too, but not in every config:


#if ENABLE_FEATURE_TAR_OLDGNU_COMPATIBILITY
        sum = strtoul(tar.chksum, &cp, 8);
        if ((*cp && *cp != ' ')
         || (sum_u != sum IF_FEATURE_TAR_OLDSUN_COMPATIBILITY(&& sum_s != sum))
        ) {
                bb_error_msg_and_die("invalid tar header checksum");
        }
#else
        /* This field does not need special treatment (getOctal) */
        sum = xstrtoul(tar.chksum, 8);   <============================= BUG
        if (sum_u != sum IF_FEATURE_TAR_OLDSUN_COMPATIBILITY(&& sum_s != sum)) {
                bb_error_msg_and_die("invalid tar header checksum");
        }
#endif

Fixed in git, thanks!
--
vda


More information about the busybox mailing list