mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 18:14:25 +03:00
(tar_decode_header): use offsetof().
Sync with GNU tar b8feb2b14247d76200fd53607d3613c82b6e5b81. Access header->buffer + offsetof (struct posix_header, magic), instead of header->header.magic, when reading or writing the OLDGNU_MAGIC pattern. The code violates the C standard without this change, and GCC warns about this if fortify checking is enabled. It's not a bug on traditional (i.e., non-debugging) platforms, but it does violate the C standard so it should be fixed. Problem originally reported by John Emil Karlson in <http://lists.gnu.org/archive/html/bug-tar/2010-04/msg00023.html>. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
4a17f02b21
commit
ea93350506
@ -474,7 +474,7 @@ tar_decode_header (union block *header, tar_super_t * arch)
|
||||
else
|
||||
arch->type = TAR_USTAR;
|
||||
}
|
||||
else if (strcmp (header->header.magic, OLDGNU_MAGIC) == 0)
|
||||
else if (strcmp (header->buffer + offsetof (struct posix_header, magic), OLDGNU_MAGIC) == 0)
|
||||
arch->type = TAR_GNU;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user