Browse code

Fixing Security bug CVE-2016-2182

Change-Id: I2938c5f18de34769faae77b025bd4913e829f177
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/1442
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Sharath George

Kumar Kaushik authored on 2016/09/22 10:31:23
Showing 2 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,34 @@
0
+diff -ru openssl-1.0.2h/crypto/bn/bn_print.c openssl-1.0.2h-modified/crypto/bn/bn_print.c
1
+--- openssl-1.0.2h/crypto/bn/bn_print.c	2016-05-03 06:44:42.000000000 -0700
2
+@@ -111,6 +111,7 @@
3
+     char *p;
4
+     BIGNUM *t = NULL;
5
+     BN_ULONG *bn_data = NULL, *lp;
6
++    int bn_data_num;
7
+ 
8
+     /*-
9
+      * get an upper bound for the length of the decimal integer
10
+@@ -120,8 +121,8 @@
11
+      */
12
+     i = BN_num_bits(a) * 3;
13
+     num = (i / 10 + i / 1000 + 1) + 1;
14
+-    bn_data =
15
+-        (BN_ULONG *)OPENSSL_malloc((num / BN_DEC_NUM + 1) * sizeof(BN_ULONG));
16
++    bn_data_num = num / BN_DEC_NUM + 1;
17
++    bn_data = OPENSSL_malloc(bn_data_num * sizeof(BN_ULONG));
18
+     buf = (char *)OPENSSL_malloc(num + 3);
19
+     if ((buf == NULL) || (bn_data == NULL)) {
20
+         BNerr(BN_F_BN_BN2DEC, ERR_R_MALLOC_FAILURE);
21
+@@ -143,7 +144,11 @@
22
+         i = 0;
23
+         while (!BN_is_zero(t)) {
24
+             *lp = BN_div_word(t, BN_DEC_CONV);
25
++            if (*lp == (BN_ULONG)-1)
26
++                goto err;
27
+             lp++;
28
++            if (lp - bn_data >= bn_data_num)
29
++                goto err;
30
+         }
31
+         lp--;
32
+         /*
... ...
@@ -1,7 +1,7 @@
1 1
 Summary:	Management tools and libraries relating to cryptography
2 2
 Name:		openssl
3 3
 Version:	1.0.2h
4
-Release:	4%{?dist}
4
+Release:	5%{?dist}
5 5
 License:	OpenSSL
6 6
 URL:		http://www.openssl.org
7 7
 Group:		System Environment/Security
... ...
@@ -14,6 +14,7 @@ Patch1:         openssl-1.0.2f-ipv6apps.patch
14 14
 Patch2:         openssl-init-conslidate.patch
15 15
 Patch3:         openssl-use-fips-drbg-by-default.patch
16 16
 Patch4:         CVE-2016-6303.patch
17
+Patch5:         CVE-2016-2182.patch
17 18
 Requires:	bash glibc libgcc 
18 19
 
19 20
 %description
... ...
@@ -55,6 +56,7 @@ Perl scripts that convert certificates and keys to various formats.
55 55
 %patch2 -p1
56 56
 %patch3 -p1
57 57
 %patch4 -p1
58
+%patch5 -p1
58 59
 
59 60
 %build
60 61
 export CFLAGS="%{optflags}"
... ...
@@ -114,6 +116,8 @@ rm -rf %{buildroot}/*
114 114
 /%{_bindir}/c_rehash
115 115
 
116 116
 %changelog
117
+*   Wed Sep 21 2016 Kumar Kaushik <kaushikk@vmware.com> 1.0.2h-5
118
+-   Security bug fix, CVE-2016-2182.
117 119
 *   Tue Sep 20 2016 Kumar Kaushik <kaushikk@vmware.com> 1.0.2h-4
118 120
 -   Security bug fix, CVE-2016-6303.
119 121
 *   Fri Jun 22 2016 Anish Swaminathan <anishs@vmware.com> 1.0.2h-3