Blame SOURCES/0001-Fix-CVE-2016-9844-rhbz-1404283.patch

7e0a4d
From 754137e70cf58a64ad524b704a86b651ba0cde07 Mon Sep 17 00:00:00 2001
7e0a4d
From: Petr Stodulka <pstodulk@redhat.com>
7e0a4d
Date: Wed, 14 Dec 2016 16:30:36 +0100
7e0a4d
Subject: [PATCH] Fix CVE-2016-9844 (rhbz#1404283)
7e0a4d
7e0a4d
Fixes buffer overflow in zipinfo in similar way like fix for
7e0a4d
CVE-2014-9913 provided by upstream.
7e0a4d
---
7e0a4d
 zipinfo.c | 14 +++++++++++++-
7e0a4d
 1 file changed, 13 insertions(+), 1 deletion(-)
7e0a4d
7e0a4d
diff --git a/zipinfo.c b/zipinfo.c
7e0a4d
index c03620e..accca2a 100644
7e0a4d
--- a/zipinfo.c
7e0a4d
+++ b/zipinfo.c
7e0a4d
@@ -1984,7 +1984,19 @@ static int zi_short(__G)   /* return PK-type error code */
7e0a4d
         ush  dnum=(ush)((G.crec.general_purpose_bit_flag>>1) & 3);
7e0a4d
         methbuf[3] = dtype[dnum];
7e0a4d
     } else if (methnum >= NUM_METHODS) {   /* unknown */
7e0a4d
-        sprintf(&methbuf[1], "%03u", G.crec.compression_method);
7e0a4d
+        /* 2016-12-05 SMS.
7e0a4d
+         * https://launchpad.net/bugs/1643750
7e0a4d
+         * Unexpectedly large compression methods overflow
7e0a4d
+         * &methbuf[].  Use the old, three-digit decimal format
7e0a4d
+         * for values which fit.  Otherwise, sacrifice the "u",
7e0a4d
+         * and use four-digit hexadecimal.
7e0a4d
+         */
7e0a4d
+        if (G.crec.compression_method <= 999) {
7e0a4d
+              sprintf( &methbuf[ 1], "%03u", G.crec.compression_method);
7e0a4d
+        } else {
7e0a4d
+              sprintf( &methbuf[ 0], "%04X", G.crec.compression_method);
7e0a4d
+        }
7e0a4d
+
7e0a4d
     }
7e0a4d
 
7e0a4d
     for (k = 0;  k < 15;  ++k)
7e0a4d
-- 
7e0a4d
2.5.5
7e0a4d