From: Sahana Prasad Date: Mon, 22 Mar 2021 10:04:45 +0000 (+0100) Subject: Allocates and initializes pubkey in X509_PUBKEY_dup() X-Git-Tag: openssl-3.0.0-alpha14~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0800c7c226c60161b49d832c342453b735984b4;p=thirdparty%2Fopenssl.git Allocates and initializes pubkey in X509_PUBKEY_dup() Fixes #14617 Signed-off-by: Sahana Prasad Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale (Merged from https://github.com/openssl/openssl/pull/14642) --- diff --git a/crypto/x509/x_pubkey.c b/crypto/x509/x_pubkey.c index b2c8e4c83ed..e9fcf8ef56d 100644 --- a/crypto/x509/x_pubkey.c +++ b/crypto/x509/x_pubkey.c @@ -209,7 +209,8 @@ X509_PUBKEY *X509_PUBKEY_dup(const X509_PUBKEY *a) { X509_PUBKEY *pubkey = NULL; - if (!x509_pubkey_ex_new(NULL, ASN1_ITEM_rptr(X509_PUBKEY_INTERNAL)) + if (!x509_pubkey_ex_new((ASN1_VALUE **)&pubkey, + ASN1_ITEM_rptr(X509_PUBKEY_INTERNAL)) || !x509_pubkey_set0_libctx(pubkey, a->libctx, a->propq) || (pubkey->algor = X509_ALGOR_dup(a->algor)) == NULL || (pubkey->public_key = ASN1_BIT_STRING_new()) == NULL