From 7820b6afdd837b87c31ce67dd070292f20c03e29 Mon Sep 17 00:00:00 2001 From: Ondrej Vasik Date: Thu, 9 Jul 2009 16:50:25 +0000 Subject: [PATCH] Do not sigabrt with new gcc/glibc because of writing to struct members of gnutar header at once via strcpy --- tar-1.22-fortifysourcessigabrt.patch | 32 ++++++++++++++++++++++++++++ tar.spec | 4 ++++ 2 files changed, 36 insertions(+) create mode 100644 tar-1.22-fortifysourcessigabrt.patch diff --git a/tar-1.22-fortifysourcessigabrt.patch b/tar-1.22-fortifysourcessigabrt.patch new file mode 100644 index 0000000..e64ec6f --- /dev/null +++ b/tar-1.22-fortifysourcessigabrt.patch @@ -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: diff --git a/tar.spec b/tar.spec index b495d53..482563e 100644 --- a/tar.spec +++ b/tar.spec @@ -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 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 2:1.22-3 - ignore errors from setting utime() for source file