-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
fix potential null pointer dereference in cms_main function in apps/cms.c #26941 #27044
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fine, but please make the suggested change.
conform the project code style Co-authored-by: Viktor Dukhovni <viktor1ghub@dukhovni.org>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed it's trivial.
Wait, I noticed there is one other place that has the same issue: |
@glorious064 Would you like to fix that incidentally? |
Lines 1137 to 1142 in 516e974
|
Sure, should I submit a new pull request? |
24 hours has passed since 'approval: done' was set, but as this PR has been updated in that time the label 'approval: ready to merge' is not being automatically set. Please review the updates and set the label manually. |
I don't think so, you can add new commits to this pull request. |
And you need to write a |
Ok, thanks for your advice.
…----------Reply to Message----------
On Wed, Apr 2, 2025 20:58 PM Paul ***@***.***> wrote:
And you need to write a CLA: trivial line in the commit message.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
InfoHunter left a comment (openssl/openssl#27044)
And you need to write a CLA: trivial line in the commit message.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Add a null check to avoid potential null pointer dereference. CLA: trivial
I have submitted a new commit. Please review it. The message includes CLA: trivial as requested. |
Checklist
How the Null Pointer Derefrence Happens:
in the cms_main function in the apps/cms.c file
At lines 1013-1015, the following code snippet is present:
pctx = CMS_RecipientInfo_get0_pkey_ctx(ri); if (kparam != NULL) { if (!cms_set_pkey_param(pctx, kparam->param))
The assignment pctx = CMS_RecipientInfo_get0_pkey_ctx(ri); suggests that pctx might be NULL. However, in the subsequent call chain:
(!cms_set_pkey_param(pctx, kparam->param))
-> pkey_ctrl_string(pctx, keyopt)
-> rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp)
-> ret = evp_pkey_ctx_store_cached_data(ctx, -1, -1, -1, name, value, strlen(value) + 1)
-> evp_pkey_ctx_state(ctx)
There are dereference operations involving pctx, which may pose a potential risk if pctx is NULL. So I add a null check:
if (pctx && !cms_set_pkey_param(pctx, kparam->param))