]> 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:30:57 +0000 (11:30 +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)

apps/cms.c
apps/ocsp.c

index 5227ec2357fc8b284555546bfd9f9dd96ea6d15c..919d306ff687f1a0943f2c6eba7dbdad93bb400e 100644 (file)
@@ -1011,7 +1011,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 bd01cf127dfbc5f6ecdabeacbda1ef26d9314533..bac054e9fcb4f7fe3ad65289cffeaaaff849e1e8 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);