tar: fix problem handling tarballs with chksums prepended by spaces

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2010-01-03 23:41:11 +01:00
parent 2d3253d1f9
commit d6459685c1

View 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"); 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)) { if (sum_u != sum IF_FEATURE_TAR_OLDSUN_COMPATIBILITY(&& sum_s != sum)) {
bb_error_msg_and_die("invalid tar header checksum"); bb_error_msg_and_die("invalid tar header checksum");
} }