Browse code

Unzip : Fix CVE-2014-9844, CVE-2014-9913

Change-Id: I09597d7da8c3b9cb6f1d6e57a3670cc18d1fa8d0
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/4108
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Anish Swaminathan <anishs@vmware.com>

xiaolin-vmware authored on 2017/10/21 03:57:02
Showing 3 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,32 @@
0
+Fix from http://antinode.info/ftp/info-zip/unzip60/zipinfo.c
1
+diff --git a/zipinfo.c b/zipinfo.c
2
+index a92bca9..8f8e729 100644
3
+--- a/zipinfo.c
4
+@@ -1,5 +1,5 @@
5
+ /*
6
+-  Copyright (c) 1990-2009 Info-ZIP.  All rights reserved.
7
++  Copyright (c) 1990-2016 Info-ZIP.  All rights reserved.
8
+ 
9
+   See the accompanying file LICENSE, version 2009-Jan-02 or later
10
+   (the contents of which are also included in unzip.h) for terms of use.
11
+@@ -1921,7 +1921,18 @@ static int zi_short(__G)   /* return PK-type error code */
12
+         ush  dnum=(ush)((G.crec.general_purpose_bit_flag>>1) & 3);
13
+         methbuf[3] = dtype[dnum];
14
+     } else if (methnum >= NUM_METHODS) {   /* unknown */
15
+-        sprintf(&methbuf[1], "%03u", G.crec.compression_method);
16
++        /* 2016-12-05 SMS.
17
++         * https://launchpad.net/bugs/1643750  CVE-2016-9844.
18
++         * Unexpectedly large compression methods overflow
19
++         * &methbuf[].  Use the old, three-digit decimal format
20
++         * for values which fit.  Otherwise, sacrifice the "u",
21
++         * and use four-digit hexadecimal.
22
++         */
23
++        if (G.crec.compression_method <= 999) {
24
++            sprintf( &methbuf[ 1], "%03u", G.crec.compression_method);
25
++        } else {
26
++            sprintf( &methbuf[ 0], "%04X", G.crec.compression_method);
27
++        }
28
+     }
29
+ 
30
+     for (k = 0;  k < 15;  ++k)
0 31
new file mode 100644
... ...
@@ -0,0 +1,32 @@
0
+Fix from http://antinode.info/ftp/info-zip/unzip60/list.c
1
+diff --git a/list.c b/list.c
2
+index 15e0011..2328788 100644
3
+--- a/list.c
4
+@@ -1,5 +1,5 @@
5
+ /*
6
+-  Copyright (c) 1990-2009 Info-ZIP.  All rights reserved.
7
++  Copyright (c) 1990-2016 Info-ZIP.  All rights reserved.
8
+ 
9
+   See the accompanying file LICENSE, version 2009-Jan-02 or later
10
+   (the contents of which are also included in unzip.h) for terms of use.
11
+@@ -339,7 +339,18 @@ int list_files(__G)    /* return PK-type error code */
12
+                 G.crec.compression_method == ENHDEFLATED) {
13
+                 methbuf[5] = dtype[(G.crec.general_purpose_bit_flag>>1) & 3];
14
+             } else if (methnum >= NUM_METHODS) {
15
+-                sprintf(&methbuf[4], "%03u", G.crec.compression_method);
16
++                /* 2013-02-26 SMS.
17
++                 * http://sourceforge.net/p/infozip/bugs/27/  CVE-2014-9913.
18
++                 * Unexpectedly large compression methods overflow
19
++                 * &methbuf[].  Use the old, three-digit decimal format
20
++                 * for values which fit.  Otherwise, sacrifice the
21
++                 * colon, and use four-digit hexadecimal.
22
++                 */
23
++                if (G.crec.compression_method <= 999) {
24
++                    sprintf( &methbuf[ 4], "%03u", G.crec.compression_method);
25
++                } else {
26
++                    sprintf( &methbuf[ 3], "%04X", G.crec.compression_method);
27
++                }
28
+             }
29
+ 
30
+ #if 0       /* GRR/Euro:  add this? */
... ...
@@ -1,21 +1,23 @@
1 1
 # FIXME: noarch or generate debuginfo
2 2
 %define debug_package %{nil}
3 3
 
4
-Summary:	Unzip-6.0
5
-Name:		unzip
6
-Version:	6.0
7
-Release:	7%{?dist}
8
-License:	BSD
9
-URL:		http://www.gnu.org/software/%{name}
10
-Source0:	http://downloads.sourceforge.net/infozip/unzip60.tar.gz
11
-%define sha1 unzip=abf7de8a4018a983590ed6f5cbd990d4740f8a22
12
-Group:		System Environment/Utilities
13
-Vendor:		VMware, Inc.
4
+Summary:        Unzip-6.0
5
+Name:           unzip
6
+Version:        6.0
7
+Release:        8%{?dist}
8
+License:        BSD
9
+URL:            http://www.gnu.org/software/%{name}
10
+Source0:        http://downloads.sourceforge.net/infozip/unzip60.tar.gz
11
+%define sha1    unzip=abf7de8a4018a983590ed6f5cbd990d4740f8a22
12
+Group:          System Environment/Utilities
13
+Vendor:         VMware, Inc.
14 14
 Distribution:   Photon
15 15
 
16 16
 Patch0:         cve-2014-9636.patch
17 17
 Patch1:         cve-2015-1315.patch
18 18
 Patch2:         CVE-2015-7696-CVE-2015-7697.patch
19
+Patch3:         unzip-CVE-2014-9844.patch
20
+Patch4:         unzip-CVE-2014-9913.patch
19 21
 
20 22
 %description
21 23
 The UnZip package contains ZIP extraction utilities. These are useful 
... ...
@@ -27,6 +29,8 @@ with PKZIP or Info-ZIP utilities, primarily in a DOS environment.
27 27
 %patch0 -p1
28 28
 %patch1 -p1
29 29
 %patch2 -p1
30
+%patch3 -p1
31
+%patch4 -p1
30 32
 
31 33
 %build
32 34
 case `uname -m` in
... ...
@@ -57,17 +61,19 @@ make -k check |& tee %{_specdir}/%{name}-check-log || %{nocheck}
57 57
 %{_bindir}/*
58 58
 
59 59
 %changelog
60
-*       Wed Nov 30 2016 Dheeraj Shetty <dheerajs@vmware.com> 6.0-7
61
--       Added patch for CVE-2015-7696 and CVE-2015-7697
62
-*       Tue Sep 20 2016 Kumar Kaushik <kaushikk@vmware.com> 6.0-6
63
--       Added patch for CVE-2015-1315
64
-*	Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 6.0-5
65
--	GA - Bump release of all rpms
66
-*	Tue May 10 2016 Nick Shi <nshi@vmware.com> 6.0-4
67
--	Added unzipsfx, zipgrep and zipinfo to unzip rpm
68
-*	Sat Aug 15 2015 Sharath George <sharathg@vmware.com> 6.0-3
69
--	Added patch for CVE-2014-9636
70
-*	Wed May 20 2015 Touseef Liaqat <tliaqat@vmware.com> 6.0-2
71
--	Updated group.
72
-*	Mon Nov 24 2014 Divya Thaluru <dthaluru@vmware.com> 6.0-1
73
--	Initial build. First version
60
+*   Fri Oct 20 2017 Xiaolin Li <xiaolinl@vmware.com> 6.0-8
61
+-   Fix CVE-2014-9844, CVE-2014-9913
62
+*   Wed Nov 30 2016 Dheeraj Shetty <dheerajs@vmware.com> 6.0-7
63
+-   Added patch for CVE-2015-7696 and CVE-2015-7697
64
+*   Tue Sep 20 2016 Kumar Kaushik <kaushikk@vmware.com> 6.0-6
65
+-   Added patch for CVE-2015-1315
66
+*   Tue May 24 2016 Priyesh Padmavilasom <ppadmavilasom@vmware.com> 6.0-5
67
+-   GA - Bump release of all rpms
68
+*   Tue May 10 2016 Nick Shi <nshi@vmware.com> 6.0-4
69
+-   Added unzipsfx, zipgrep and zipinfo to unzip rpm
70
+*   Sat Aug 15 2015 Sharath George <sharathg@vmware.com> 6.0-3
71
+-   Added patch for CVE-2014-9636
72
+*   Wed May 20 2015 Touseef Liaqat <tliaqat@vmware.com> 6.0-2
73
+-   Updated group.
74
+*   Mon Nov 24 2014 Divya Thaluru <dthaluru@vmware.com> 6.0-1
75
+-   Initial build. First version