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:30:45 +0000 (04:30 +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)

apps/rsa.c

index 5098a20..fdd02dc 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) {