]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Fix a possible memleak in cms_main
authorBernd Edlinger <bernd.edlinger@hotmail.de>
Sun, 3 Dec 2023 10:24:18 +0000 (11:24 +0100)
committerTomas Mraz <tomas@openssl.org>
Tue, 12 Dec 2023 18:45:09 +0000 (19:45 +0100)
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22918)

apps/cms.c

index a16318f37c106fa8f280b3a458f5a02064161799..f93c98ac92c4164bfbc2b10953e2ce62d8e9655d 100644 (file)
@@ -628,7 +628,8 @@ int cms_main(int argc, char **argv)
                                  "recipient certificate file");
                 if (cert == NULL)
                     goto end;
-                sk_X509_push(encerts, cert);
+                if (!sk_X509_push(encerts, cert))
+                    goto end;
                 cert = NULL;
             } else {
                 recipfile = opt_arg();
@@ -837,7 +838,8 @@ int cms_main(int argc, char **argv)
                              "recipient certificate file");
             if (cert == NULL)
                 goto end;
-            sk_X509_push(encerts, cert);
+            if (!sk_X509_push(encerts, cert))
+                goto end;
             cert = NULL;
         }
     }