]> 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:31:46 +0000 (11:31 +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 b1ce8a8bd0a287f36ae32d76d5a95377dd33e958..0b0bc949c98d0a4d3d9df50bb79ffe5201726913 100644 (file)
@@ -1013,7 +1013,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 97454a4b81dd7223d48a2094beaeb2afe1a90de4..11af0a3a6fc31adc05a3273db673ebe0e0eb288a 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);