summaryrefslogtreecommitdiff
path: root/archival/libunarchive/get_header_tar.c
diff options
context:
space:
mode:
authorDenis Vlasenko2006-10-10 21:00:47 +0000
committerDenis Vlasenko2006-10-10 21:00:47 +0000
commitcba9ef5523f09ecc3240f9f6efcdd0440c652c91 (patch)
tree79a2f859df1f6eef15defd02bd2f453735ed327e /archival/libunarchive/get_header_tar.c
parent1ac42bf66e2c181b886e89f9222cae65676c9e8a (diff)
downloadbusybox-cba9ef5523f09ecc3240f9f6efcdd0440c652c91.zip
busybox-cba9ef5523f09ecc3240f9f6efcdd0440c652c91.tar.gz
fixes from Vladimir Dronnikov <dronnikov@gmail.ru>
Diffstat (limited to 'archival/libunarchive/get_header_tar.c')
-rw-r--r--archival/libunarchive/get_header_tar.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c
index d3cd96d..f78377e 100644
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -74,12 +74,12 @@ char get_header_tar(archive_handle_t *archive_handle)
*/
if (strncmp(tar.formatted.magic, "ustar", 5) != 0) {
#ifdef CONFIG_FEATURE_TAR_OLDGNU_COMPATIBILITY
- if (strncmp(tar.formatted.magic, "\0\0\0\0\0", 5) != 0)
+ if (memcmp(tar.formatted.magic, "\0\0\0\0", 5) != 0)
#endif
bb_error_msg_and_die("invalid tar magic");
}
/* Do checksum on headers */
- for (i = 0; i < 148 ; i++) {
+ for (i = 0; i < 148 ; i++) {
sum += tar.raw[i];
}
sum += ' ' * 8;
@@ -111,13 +111,14 @@ char get_header_tar(archive_handle_t *archive_handle)
file_header->uid = xstrtoul(tar.formatted.uid, 8);
file_header->gid = xstrtoul(tar.formatted.gid, 8);
- // TODO: LFS support
- file_header->size = xstrtoul(tar.formatted.size, 8);
+ file_header->size = XSTRTOUOFF(tar.formatted.size, 8);
file_header->mtime = xstrtoul(tar.formatted.mtime, 8);
file_header->link_name = tar.formatted.linkname[0] ?
xstrdup(tar.formatted.linkname) : NULL;
- file_header->device = makedev(xstrtoul(tar.formatted.devmajor, 8),
- xstrtoul(tar.formatted.devminor, 8));
+ if (tar.formatted.devmajor[0]) {
+ file_header->device = makedev(xstrtoul(tar.formatted.devmajor, 8),
+ xstrtoul(tar.formatted.devminor, 8));
+ }
/* Set bits 0-11 of the files mode */
file_header->mode = 07777 & xstrtoul(tar.formatted.mode, 8);