From: Ankit Kekre Date: Thu, 13 Mar 2025 15:59:54 +0000 (+0530) Subject: apps/cms.c, apps/ocsp.c: Added NULL pointer checks X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=952d9b83b20359e9ed0fff8f18a84add29949f6f;p=thirdparty%2Fopenssl.git apps/cms.c, apps/ocsp.c: Added NULL pointer checks Reviewed-by: Paul Dale Reviewed-by: Tim Hudson Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/27059) --- diff --git a/apps/cms.c b/apps/cms.c index 5227ec2357f..919d306ff68 100644 --- a/apps/cms.c +++ b/apps/cms.c @@ -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; } diff --git a/apps/ocsp.c b/apps/ocsp.c index bd01cf127df..bac054e9fcb 100644 --- a/apps/ocsp.c +++ b/apps/ocsp.c @@ -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);