summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/openssl/openssl/CVE-2015-3195-Fix-leak-with-ASN.1-combine.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/openssl/openssl/CVE-2015-3195-Fix-leak-with-ASN.1-combine.patch')
-rw-r--r--meta/recipes-connectivity/openssl/openssl/CVE-2015-3195-Fix-leak-with-ASN.1-combine.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/openssl/openssl/CVE-2015-3195-Fix-leak-with-ASN.1-combine.patch b/meta/recipes-connectivity/openssl/openssl/CVE-2015-3195-Fix-leak-with-ASN.1-combine.patch
new file mode 100644
index 0000000000..be705c022b
--- /dev/null
+++ b/meta/recipes-connectivity/openssl/openssl/CVE-2015-3195-Fix-leak-with-ASN.1-combine.patch
@@ -0,0 +1,61 @@
1commit b29ffa392e839d05171206523e84909146f7a77c
2Author: Dr. Stephen Henson <steve@openssl.org>
3Date: Tue, 10 Nov 2015 19:03:07 +0000
4Subject: Fix leak with ASN.1 combine.
5
6When parsing a combined structure pass a flag to the decode routine
7so on error a pointer to the parent structure is not zeroed as
8this will leak any additional components in the parent.
9
10This can leak memory in any application parsing PKCS#7 or CMS structures.
11
12CVE-2015-3195.
13
14Upstream-Status: Backport
15
16Thanks to Adam Langley (Google/BoringSSL) for discovering this bug using
17libFuzzer.
18
19PR#4131
20
21Reviewed-by: Richard Levitte <levitte@openssl.org>
22Signed-off-by: Sona Sarmadi <sona.sarmadi@enea.com>
23---
24 crypto/asn1/tasn_dec.c | 7 +++++--
25 1 file changed, 5 insertions(+), 2 deletions(-)
26
27diff --git a/crypto/asn1/tasn_dec.c b/crypto/asn1/tasn_dec.c
28index febf605..9256049 100644
29--- a/crypto/asn1/tasn_dec.c
30+++ b/crypto/asn1/tasn_dec.c
31@@ -180,6 +180,8 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
32 int otag;
33 int ret = 0;
34 ASN1_VALUE **pchptr, *ptmpval;
35+ int combine = aclass & ASN1_TFLG_COMBINE;
36+ aclass &= ~ASN1_TFLG_COMBINE;
37 if (!pval)
38 return 0;
39 if (aux && aux->asn1_cb)
40@@ -500,7 +502,8 @@ int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
41 auxerr:
42 ASN1err(ASN1_F_ASN1_ITEM_EX_D2I, ASN1_R_AUX_ERROR);
43 err:
44- ASN1_item_ex_free(pval, it);
45+ if (combine == 0)
46+ ASN1_item_ex_free(pval, it);
47 if (errtt)
48 ERR_add_error_data(4, "Field=", errtt->field_name,
49 ", Type=", it->sname);
50@@ -689,7 +692,7 @@ static int asn1_template_noexp_d2i(ASN1_VALUE **val,
51 } else {
52 /* Nothing special */
53 ret = ASN1_item_ex_d2i(val, &p, len, ASN1_ITEM_ptr(tt->item),
54- -1, 0, opt, ctx);
55+ -1, tt->flags & ASN1_TFLG_COMBINE, opt, ctx);
56 if (!ret) {
57 ASN1err(ASN1_F_ASN1_TEMPLATE_NOEXP_D2I, ERR_R_NESTED_ASN1_ERROR);
58 goto err;
59--
601.9.1
61