diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-08 18:58:09 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2009-07-08 18:58:09 +0200 |
commit | b773f715d617e5c978f7b6fb39ecb7b50ab5568a (patch) | |
tree | 2dc65b73990afed9019b0f865db6bc4018cf20c9 /archival/libunarchive | |
parent | da49f5852481adb0b3fa0b5ccba93b266f271c35 (diff) | |
download | busybox-b773f715d617e5c978f7b6fb39ecb7b50ab5568a.tar.gz |
tar: handle 256-base encoding in mtime
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'archival/libunarchive')
-rw-r--r-- | archival/libunarchive/get_header_tar.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c index 16e2de440..71e08bf7d 100644 --- a/archival/libunarchive/get_header_tar.c +++ b/archival/libunarchive/get_header_tar.c @@ -301,9 +301,13 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) file_header->uname = tar.uname[0] ? xstrndup(tar.uname, sizeof(tar.uname)) : NULL; file_header->gname = tar.gname[0] ? xstrndup(tar.gname, sizeof(tar.gname)) : NULL; #endif - file_header->mtime = GET_OCTAL(tar.mtime); - /* Size field: handle GNU tar's "base256 encoding" */ - file_header->size = (*tar.size & 0xc0) == 0x80 /* positive base256? */ + /* mtime: rudimentally handle GNU tar's "base256 encoding" + * People report tarballs with NEGATIVE unix times encoded that way */ + file_header->mtime = (tar.mtime[0] & 0x80) /* base256? */ + ? 0 /* bogus */ + : GET_OCTAL(tar.mtime); + /* size: handle GNU tar's "base256 encoding" */ + file_header->size = (tar.size[0] & 0xc0) == 0x80 /* positive base256? */ ? getBase256_len12(tar.size) : GET_OCTAL(tar.size); file_header->gid = GET_OCTAL(tar.gid); |