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 --- a/crypto/dh/dh_ameth.c
12 +++ b/crypto/dh/dh_ameth.c
16 str = ASN1_STRING_new();
19 + DHerr(DH_F_DH_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
23 str->length = i2d_DHparams(dh, &str->data);
26 --- a/crypto/dsa/dsa_ameth.c
27 +++ b/crypto/dsa/dsa_ameth.c
31 str = ASN1_STRING_new();
34 + DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
37 str->length = i2d_DSAparams(dsa, &str->data);