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