Check return value of EVP_PKEY_new
authorMansour Ahmadi <m.ahmadi@northeastern.edu>
Wed, 17 Oct 2018 22:13:57 +0000 (18:13 -0400)
committerNicola Tuveri <nic.tuv@gmail.com>
Sat, 10 Nov 2018 02:42:29 +0000 (04:42 +0200)
Reviewed-by: Paul Yang <yang.yang@baishancloud.com>
Reviewed-by: Nicola Tuveri <nic.tuv@gmail.com>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7427)

(cherry picked from commit d896b79b0994a35ecfd1c8e729d348d67236150e)

apps/rsa.c

index 5098a20dbc7216723b770759de4b499cde89904e..fdd02dce32419a764ac7e7b7fc9eaa4fd4b80409 100644 (file)
@@ -269,6 +269,9 @@ int rsa_main(int argc, char **argv)
     } else if (outformat == FORMAT_MSBLOB || outformat == FORMAT_PVK) {
         EVP_PKEY *pk;
         pk = EVP_PKEY_new();
+        if (pk == NULL)
+            goto end;
+
         EVP_PKEY_set1_RSA(pk, rsa);
         if (outformat == FORMAT_PVK) {
             if (pubin) {