From: Dr. Stephen Henson <steve@openssl.org>
Date: Wed, 18 Feb 2015 00:34:59 +0000 (+0000)
Subject: Check public key is not NULL.
X-Git-Tag: OpenSSL_1_0_2a~56
X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9fdbaf3a322689a58381c724e4f3497320a69581;p=oweals%2Fopenssl.git

Check public key is not NULL.

CVE-2015-0288
PR#3708

Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 28a00bcd8e318da18031b2ac8778c64147cd54f9)
---

diff --git a/crypto/x509/x509_req.c b/crypto/x509/x509_req.c
index bc6e566c95..01795f4b3f 100644
--- a/crypto/x509/x509_req.c
+++ b/crypto/x509/x509_req.c
@@ -92,6 +92,8 @@ X509_REQ *X509_to_X509_REQ(X509 *x, EVP_PKEY *pkey, const EVP_MD *md)
         goto err;
 
     pktmp = X509_get_pubkey(x);
+    if (pktmp == NULL)
+        goto err;
     i = X509_REQ_set_pubkey(ret, pktmp);
     EVP_PKEY_free(pktmp);
     if (!i)