Check public key is not NULL.
authorDr. Stephen Henson <steve@openssl.org>
Wed, 18 Feb 2015 00:34:59 +0000 (00:34 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 2 Mar 2015 15:24:53 +0000 (15:24 +0000)
CVE-2015-0288
PR#3708

Reviewed-by: Matt Caswell <matt@openssl.org>
crypto/x509/x509_req.c

index bc6e566c95b427de0503375a117740354248f794..01795f4b3f370eb7300986b06df9c98de96c2221 100644 (file)
@@ -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)