]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
apps/cms.c, apps/ocsp.c: Added NULL pointer checks
authorAnkit Kekre <ankit.kekre5@gmail.com>
Thu, 13 Mar 2025 15:59:54 +0000 (21:29 +0530)
committerTomas Mraz <tomas@openssl.org>
Thu, 20 Mar 2025 10:32:08 +0000 (11:32 +0100)
Reviewed-by: Paul Dale <ppzgs1@gmail.com>
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/27059)

(cherry picked from commit 952d9b83b20359e9ed0fff8f18a84add29949f6f)

apps/cms.c
apps/ocsp.c

index dce227ef2db5abfc8f7aa4b7476eceb62c688d51..185396ca7b380984befaaa42d0d8bcf4acd220ad 100644 (file)
@@ -983,7 +983,7 @@ int cms_main(int argc, char **argv)
                 goto end;
 
             pctx = CMS_RecipientInfo_get0_pkey_ctx(ri);
-            if (kparam != NULL) {
+            if (pctx != NULL && kparam != NULL) {
                 if (!cms_set_pkey_param(pctx, kparam->param))
                     goto end;
             }
index fb3105da55266063a7048148f956eba91a565514..94f737dd3b8ad5639839dac99ece957a77db5858 100644 (file)
@@ -1049,6 +1049,10 @@ static void make_ocsp_response(BIO *err, OCSP_RESPONSE **resp, OCSP_REQUEST *req
     }
 
     bs = OCSP_BASICRESP_new();
+    if (bs == NULL) {
+        *resp = OCSP_response_create(OCSP_RESPONSE_STATUS_INTERNALERROR, bs);
+        goto end;
+    }
     thisupd = X509_gmtime_adj(NULL, 0);
     if (ndays != -1)
         nextupd = X509_time_adj_ex(NULL, ndays, nmin * 60, NULL);