From d6459685c1a93785d0bdf94e16834a6d4c54842f Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 3 Jan 2010 23:41:11 +0100 Subject: [PATCH] tar: fix problem handling tarballs with chksums prepended by spaces Signed-off-by: Denys Vlasenko --- archival/libunarchive/get_header_tar.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c index b8d7648ec..1f799277b 100644 --- a/archival/libunarchive/get_header_tar.c +++ b/archival/libunarchive/get_header_tar.c @@ -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"); } -- 2.25.1