1 openssl: avoid NULL pointer dereference in dh_pub_encode()/dsa_pub_encode()
3 We should avoid accessing the pointer if ASN1_STRING_new()
4 allocates memory failed.
6 Upstream-Status: Submitted
7 http://www.mail-archive.com/openssl-dev@openssl.org/msg32859.html
9 Signed-off-by: Xufeng Zhang <xufeng.zhang@windriver.com>
11 Index: openssl-1.0.2/crypto/dh/dh_ameth.c
12 ===================================================================
13 --- openssl-1.0.2.orig/crypto/dh/dh_ameth.c
14 +++ openssl-1.0.2/crypto/dh/dh_ameth.c
15 @@ -161,6 +161,11 @@ static int dh_pub_encode(X509_PUBKEY *pk
18 str = ASN1_STRING_new();
20 + DHerr(DH_F_DH_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
24 str->length = i2d_dhp(pkey, dh, &str->data);
25 if (str->length <= 0) {
26 DHerr(DH_F_DH_PUB_ENCODE, ERR_R_MALLOC_FAILURE);