Add patch to fix issue1926
authorAndre Heinecke <aheinecke@intevation.de>
Tue, 17 Mar 2015 11:16:34 +0000 (12:16 +0100)
committerAndre Heinecke <aheinecke@intevation.de>
Tue, 17 Mar 2015 11:16:34 +0000 (12:16 +0100)
* Makefile.am (EXTRA_DIST): Add patch.
* patches/gnupg2-2.0.27/
  0003-gpgtar-Fix-extracting-files-with-size-512.patch: New.
* NEWS: Mention this.

Makefile.am
NEWS
patches/gnupg2-2.0.27/0003-gpgtar-Fix-extracting-files-with-size-512.patch [new file with mode: 0755]

index affba94..8a4026b 100644 (file)
@@ -40,6 +40,7 @@ EXTRA_DIST = autogen.sh README.GIT ONEWS \
         patches/glib-2.41.0/03-remove-rand_s.patch \
         patches/gnupg2-2.0.27/0001-Enable-wildcard-expansion-with-mingw-w64.patch \
         patches/gnupg2-2.0.27/0002-Let-wchar_to_native-convert-to-console-codepage.patch \
+        patches/gnupg2-2.0.27/0003-gpgtar-Fix-extracting-files-with-size-512.patch \
         patches/gnupg2-2.0.27/0005-Fix-gpgtar-8-bit-encoding-handling-on-Win32.patch \
         patches/gnupg2/01-version.patch \
         patches/gnupg2/01-version.patch.in \
diff --git a/NEWS b/NEWS
index c7ff35e..dc10d55 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,12 @@ Noteworthy changes in version 2.2.4 (unreleased)
 (de) Libgcrypt wurde auf Version 1.6.3 aktualisiert (enthält den
      fix für CVE-2014-3591)
 
+(en) An issue has been fixed which could cause extracted files from
+     TAR Archives to be truncated.
+
+(de) Ein Problem wurde behoben durch welches Ausgabedateien beim
+     extrahieren von TAR Archiven beschädigt wurden.
+
 ~~~~~~~~~~~~~~~
 GnuPG:          2.0.27
 Kleopatra:      2.2.0-git945878c
diff --git a/patches/gnupg2-2.0.27/0003-gpgtar-Fix-extracting-files-with-size-512.patch b/patches/gnupg2-2.0.27/0003-gpgtar-Fix-extracting-files-with-size-512.patch
new file mode 100755 (executable)
index 0000000..ddde7df
--- /dev/null
@@ -0,0 +1,47 @@
+#! /bin/sh
+patch -p1 -l -f $* < $0
+exit $?
+
+From 0ed2cfcf054e286b238d4ddbbb3e929482849a47 Mon Sep 17 00:00:00 2001
+From: Andre Heinecke <aheinecke@intevation.de>
+Date: Tue, 17 Mar 2015 10:48:09 +0100
+Subject: [PATCH 1/4] gpgtar: Fix extracting files with !(size % 512)
+
+* tools/gpgtar-extract.c (extract_regular): Handle size multiples
+  of RECORDSIZE.
+
+--
+  If a hdr->size was a multiple of 512 the last record would
+  not have been written and the files corrupted accordingly.
+
+GnuPG-bug-id: 1926
+
+Signed-off-by: Andre Heinecke <aheinecke@intevation.de>
+
+Changed to use only if-else.
+
+Signed-off-by: Werner Koch <wk@gnupg.org>
+(cherry picked from commit 6cbbb0bec98e1acefc4c7163cc41a507469db920)
+---
+ tools/gpgtar-extract.c | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/tools/gpgtar-extract.c b/tools/gpgtar-extract.c
+index 736c7fc..b0d31e0 100644
+--- a/tools/gpgtar-extract.c
++++ b/tools/gpgtar-extract.c
+@@ -73,7 +73,11 @@ extract_regular (estream_t stream, const char *dirname,
+       if (err)
+         goto leave;
+       n++;
+-      nbytes = (n < hdr->nrecords)? RECORDSIZE : (hdr->size % RECORDSIZE);
++      if (n < hdr->nrecords || (hdr->size && !(hdr->size % RECORDSIZE)))
++        nbytes = RECORDSIZE;
++      else
++        nbytes = (hdr->size % RECORDSIZE);
++
+       nwritten = es_fwrite (record, 1, nbytes, outfp);
+       if (nwritten != nbytes)
+         {
+--
+1.9.1