From: mrpre Date: Fri, 28 Aug 2015 08:12:51 +0000 (+0800) Subject: check bn_new return value X-Git-Tag: OpenSSL_1_1_0-pre1~756 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a7e974c7be90e2c9673e2ce6215a70f734eb8ad4;p=oweals%2Fopenssl.git check bn_new return value Slightly modified from the original PR. Signed-off-by: Rich Salz Reviewed-by: Richard Levitte --- diff --git a/crypto/asn1/x_bignum.c b/crypto/asn1/x_bignum.c index 66ce000827..d2666e15da 100644 --- a/crypto/asn1/x_bignum.c +++ b/crypto/asn1/x_bignum.c @@ -163,8 +163,8 @@ static int bn_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, { BIGNUM *bn; - if (!*pval) - bn_new(pval, it); + if (*pval == NULL && !bn_new(pval, it)) + return 0; bn = (BIGNUM *)*pval; if (!BN_bin2bn(cont, len, bn)) { bn_free(pval, it);