Do not sigabrt with new gcc/glibc because of writing to struct members of

gnutar header at once via strcpy
This commit is contained in:
Ondrej Vasik 2009-07-09 16:50:25 +00:00
parent 6d2f2e3091
commit 7820b6afdd
2 changed files with 36 additions and 0 deletions

View File

@ -0,0 +1,32 @@
diff -urNp tar-1.22-orig/src/create.c tar-1.22/src/create.c
--- tar-1.22-orig/src/create.c 2009-07-09 18:38:37.000000000 +0200
+++ tar-1.22/src/create.c 2009-07-09 18:43:44.000000000 +0200
@@ -578,7 +578,10 @@ write_gnu_long_link (struct tar_stat_inf
GNAME_TO_CHARS (tmpname, header->header.gname);
free (tmpname);
- strcpy (header->header.magic, OLDGNU_MAGIC);
+ /* OLDGNU_MAGIC is string with 7 chars + NULL */
+ strncpy (header->header.magic, OLDGNU_MAGIC, sizeof(header->header.magic));
+ strncpy (header->header.version, OLDGNU_MAGIC+sizeof(header->header.magic),
+ sizeof(header->header.version));
header->header.typeflag = type;
finish_header (st, header, -1);
@@ -908,9 +911,13 @@ start_header (struct tar_stat_info *st)
break;
case OLDGNU_FORMAT:
- case GNU_FORMAT: /*FIXME?*/
- /* Overwrite header->header.magic and header.version in one blow. */
- strcpy (header->header.magic, OLDGNU_MAGIC);
+ case GNU_FORMAT:
+ /* OLDGNU_MAGIC is string with 7 chars + NULL */
+ strncpy (header->header.magic, OLDGNU_MAGIC,
+ sizeof(header->header.magic));
+ strncpy (header->header.version,
+ OLDGNU_MAGIC+sizeof(header->header.magic),
+ sizeof(header->header.version));
break;
case POSIX_FORMAT:

View File

@ -16,6 +16,7 @@ Patch4: tar-1.19-xattrs-conf.patch
Patch5: tar-1.17-wildcards.patch
Patch6: tar-1.22-atime-rofs.patch
Patch7: tar-1.22-shortreadbuffer.patch
Patch8: tar-1.22-fortifysourcessigabrt.patch
Prereq: info
BuildRequires: autoconf automake gzip texinfo gettext libacl-devel libselinux-devel gawk rsh
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -43,6 +44,7 @@ the rmt package.
%patch5 -p1 -b .wildcards
%patch6 -p1 -b .rofs
%patch7 -p1 -b .shortread
%patch8 -p1 -b .headerblackmagic
%build
%configure --bindir=/bin --libexecdir=/sbin
@ -96,6 +98,8 @@ fi
* Thu Jun 25 2009 Ondrej Vasik <ovasik@redhat.com> 2:1.22-4
- Report record size only if the archive refers to a device
(#487760)
- Do not sigabrt with new gcc/glibc because of writing to
struct members of gnutar header at once via strcpy
* Fri May 15 2009 Ondrej Vasik <ovasik@redhat.com> 2:1.22-3
- ignore errors from setting utime() for source file