From 1c7c69a8a5735aeb9c8b3d732b5bee090e3b8604 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bodo=20M=C3=B6ller?= Date: Mon, 5 Sep 2011 09:56:48 +0000 Subject: [PATCH] Fix memory leak on bad inputs. --- CHANGES | 3 +++ crypto/asn1/x_name.c | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index a3ee3b0bc6..a885be40f6 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,9 @@ Changes between 0.9.8r and 0.9.8s [xx XXX xxxx] + *) Fix x509_name_ex_d2i memory leak on bad inputs. + [Bodo Moeller] + *) Add protection against ECDSA timing attacks as mentioned in the paper by Billy Bob Brumley and Nicola Tuveri, see: diff --git a/crypto/asn1/x_name.c b/crypto/asn1/x_name.c index 04380abc3f..9a1a9f415f 100644 --- a/crypto/asn1/x_name.c +++ b/crypto/asn1/x_name.c @@ -196,7 +196,9 @@ static int x509_name_ex_d2i(ASN1_VALUE **val, const unsigned char **in, long len *val = nm.a; *in = p; return ret; - err: +err: + if (nm.x != NULL) + X509_NAME_free(nm.x); ASN1err(ASN1_F_X509_NAME_EX_D2I, ERR_R_NESTED_ASN1_ERROR); return 0; } -- 2.25.1