]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Use a proper structure for a test for gnutar header.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Mon, 3 Dec 2012 03:36:06 +0000 (12:36 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Mon, 3 Dec 2012 03:36:06 +0000 (12:36 +0900)
libarchive/archive_read_support_format_tar.c

index 7ae2e0b5e91bc862c5e1e66cc52c5c0cd78f8216..e9523cb687c8224c9c7a1360863be32bc0baebc0 100644 (file)
@@ -617,6 +617,7 @@ tar_read_header(struct archive_read *a, struct tar *tar,
        int err;
        const char *h;
        const struct archive_entry_header_ustar *header;
+       const struct archive_entry_header_gnutar *gnuheader;
 
        tar_flush_unconsumed(a, unconsumed);
 
@@ -704,7 +705,8 @@ tar_read_header(struct archive_read *a, struct tar *tar,
                err = header_pax_extensions(a, tar, entry, h, unconsumed);
                break;
        default:
-               if (memcmp(header->magic, "ustar  \0", 8) == 0) {
+               gnuheader = (const struct archive_entry_header_gnutar *)h;
+               if (memcmp(gnuheader->magic, "ustar  \0", 8) == 0) {
                        a->archive.archive_format = ARCHIVE_FORMAT_TAR_GNUTAR;
                        a->archive.archive_format_name = "GNU tar format";
                        err = header_gnutar(a, tar, entry, h, unconsumed);