Commit 93043b1f authored by AlmAck's avatar AlmAck
Browse files

Fix CVE-2016-9844 in unzip

parent ce34f1ae
From: "Steven M. Schweda" <sms@antinode.info>
Subject: Fix CVE-2016-9844, buffer overflow in zipinfo
Bug-Debian: https://bugs.debian.org/847486
Bug-Ubuntu: https://launchpad.net/bugs/1643750
X-Debian-version: 6.0-21
--- a/zipinfo.c
+++ b/zipinfo.c
@@ -1921,7 +1921,18 @@ static int zi_short(__G) /* return PK-
ush dnum=(ush)((G.crec.general_purpose_bit_flag>>1) & 3);
methbuf[3] = dtype[dnum];
} else if (methnum >= NUM_METHODS) { /* unknown */
- sprintf(&methbuf[1], "%03u", G.crec.compression_method);
+ /* 2016-12-05 SMS.
+ * https://launchpad.net/bugs/1643750
+ * Unexpectedly large compression methods overflow
+ * &methbuf[]. Use the old, three-digit decimal format
+ * for values which fit. Otherwise, sacrifice the "u",
+ * and use four-digit hexadecimal.
+ */
+ if (G.crec.compression_method <= 999) {
+ sprintf( &methbuf[ 1], "%03u", G.crec.compression_method);
+ } else {
+ sprintf( &methbuf[ 0], "%04X", G.crec.compression_method);
+ }
}
for (k = 0; k < 15; ++k)
......@@ -5,7 +5,7 @@
pkgname=unzip
pkgver=6.0
pkgrel=8
pkgrel=9
pkgdesc="Unpacks .zip archives such as those made by PKZIP"
arch=('x86_64')
url="http://www.info-zip.org/"
......@@ -19,6 +19,7 @@ source=('http://downloads.sourceforge.net/infozip/unzip60.tar.gz'
CVE-2014-9636-overflow-fsize.patch
CVE-2015-7696+CVE-2015-7697-csiz-underflow.patch
CVE-2015-7696+CVE-2015-7697-heap-overflow.patch
CVE-2016-9844-zipinfo-buffer-overflow.patch
iconv-utf8+CVE-2015-1315.patch)
md5sums=('62b490407489521db863b523a7f86375'
'86fdb01be92ca170fca89ed9e914a560'
......@@ -28,6 +29,7 @@ md5sums=('62b490407489521db863b523a7f86375'
'0e9e554ff80396f391709cf98ff26b7c'
'1935de2ff982992d8d7e8c5c360add03'
'cdc14eca25a4de37148822830046bca2'
'f460e0b6e4b9f01b2d637827c3b20341'
'1addc224d4168d76a69be84cb0a32d31')
prepare(){
......@@ -41,6 +43,7 @@ prepare(){
patch -Np1 -i ${srcdir}/CVE-2014-9636-overflow-fsize.patch
patch -Np1 -i "${srcdir}"/CVE-2015-7696+CVE-2015-7697-csiz-underflow.patch
patch -Np1 -i "${srcdir}"/CVE-2015-7696+CVE-2015-7697-heap-overflow.patch
patch -Np1 -i "${srcdir}"/CVE-2016-9844-zipinfo-buffer-overflow.patch
patch -Np1 -i "${srcdir}"/iconv-utf8+CVE-2015-1315.patch
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment