diff options
-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) | |||
301 | file_header->uname = tar.uname[0] ? xstrndup(tar.uname, sizeof(tar.uname)) : NULL; | 301 | file_header->uname = tar.uname[0] ? xstrndup(tar.uname, sizeof(tar.uname)) : NULL; |
302 | file_header->gname = tar.gname[0] ? xstrndup(tar.gname, sizeof(tar.gname)) : NULL; | 302 | file_header->gname = tar.gname[0] ? xstrndup(tar.gname, sizeof(tar.gname)) : NULL; |
303 | #endif | 303 | #endif |
304 | file_header->mtime = GET_OCTAL(tar.mtime); | 304 | /* mtime: rudimentally handle GNU tar's "base256 encoding" |
305 | /* Size field: handle GNU tar's "base256 encoding" */ | 305 | * People report tarballs with NEGATIVE unix times encoded that way */ |
306 | file_header->size = (*tar.size & 0xc0) == 0x80 /* positive base256? */ | 306 | file_header->mtime = (tar.mtime[0] & 0x80) /* base256? */ |
307 | ? 0 /* bogus */ | ||
308 | : GET_OCTAL(tar.mtime); | ||
309 | /* size: handle GNU tar's "base256 encoding" */ | ||
310 | file_header->size = (tar.size[0] & 0xc0) == 0x80 /* positive base256? */ | ||
307 | ? getBase256_len12(tar.size) | 311 | ? getBase256_len12(tar.size) |
308 | : GET_OCTAL(tar.size); | 312 | : GET_OCTAL(tar.size); |
309 | file_header->gid = GET_OCTAL(tar.gid); | 313 | file_header->gid = GET_OCTAL(tar.gid); |