* src/create.c (write_gnu_long_link, start_header): 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>.
* src/list.c (decode_header): Likewise.
GNAME_TO_CHARS (tmpname, header->header.gname);
free (tmpname);
- strcpy (header->header.magic, OLDGNU_MAGIC);
+ strcpy (header->buffer + offsetof (struct posix_header, magic),
+ OLDGNU_MAGIC);
header->header.typeflag = type;
finish_header (st, header, -1);
case OLDGNU_FORMAT:
case GNU_FORMAT: /*FIXME?*/
/* Overwrite header->header.magic and header.version in one blow. */
- strcpy (header->header.magic, OLDGNU_MAGIC);
+ strcpy (header->buffer + offsetof (struct posix_header, magic),
+ OLDGNU_MAGIC);
break;
case POSIX_FORMAT:
if (typeflag == GNUTYPE_VOLHDR)
/* Name transformations don't apply to volume headers. */
return;
-
+
transform_member_name (&stat_info->file_name, XFORM_REGFILE);
switch (typeflag)
{
else
format = USTAR_FORMAT;
}
- else if (strcmp (header->header.magic, OLDGNU_MAGIC) == 0)
+ else if (strcmp (header->buffer + offsetof (struct posix_header, magic),
+ OLDGNU_MAGIC)
+ == 0)
format = hbits ? OLDGNU_FORMAT : GNU_FORMAT;
else
format = V7_FORMAT;