tar: fix problem handling tarballs with chksums prepended by spaces
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index b8d7648..1f79927 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -274,7 +274,8 @@
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");
}