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-Tag: openssl-3.0.17~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e2ae38df24001d219377c9d854f58e47bece396;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) (cherry picked from commit 952d9b83b20359e9ed0fff8f18a84add29949f6f) --- diff --git a/apps/cms.c b/apps/cms.c index dce227ef2db..185396ca7b3 100644 --- a/apps/cms.c +++ b/apps/cms.c @@ -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; } diff --git a/apps/ocsp.c b/apps/ocsp.c index fb3105da552..94f737dd3b8 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);