tar: fix problem handling tarballs with chksums prepended by spaces
authorDenys Vlasenko <vda.linux@googlemail.com>
Sun, 3 Jan 2010 22:41:11 +0000 (23:41 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 3 Jan 2010 22:41:11 +0000 (23:41 +0100)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
archival/libunarchive/get_header_tar.c

index b8d7648ecb4640faee6edece83ea7647b14fe2aa..1f799277b2a87f70b83e0f2fa14b9a44f81716c4 100644 (file)
@@ -274,7 +274,8 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
                        bb_error_msg_and_die("invalid tar header checksum");
                }
        }
-       sum = xstrtoul(tar.chksum, 8);
+       /* 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");
        }