-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
crypto: replace goto SSL_CTX_use_certificate_chain #23113
Conversation
src/node_crypto.cc
Outdated
X509* extra = nullptr; | ||
int ret = 0; | ||
OnScopeLeave cleanup([&extra, &ret] { | ||
if (ret) |
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.
There is a potential footgun here. Someone someday might look at line 686 and see this:
ret = SSL_CTX_use_certificate_chain(...);
return ret;
And change that to:
return SSL_CTX_use_certificate_chain(...);
Without realizing that the assignment to ret
is necessary because of its side effects. Probably also easy to miss in code review.
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.
I think we could really do a variant here that uses a smart pointer and releases it if necessary; it’s just not trivial to translate the code to that…
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.
Sorry about the late response on this. I'll take another stab at this today. Thanks
bbfee1c
to
6540586
Compare
This commit removes the goto statements in SSL_CTX_use_certificate_chain by using a unique_ptr.
6540586
to
a46fae0
Compare
Updated CI: https://ci.nodejs.org/job/node-test-pull-request/17623/ (:heavy_check_mark:) |
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.
Nice, thank you!
Landed in 8d218a9. |
This commit removes the goto statements in SSL_CTX_use_certificate_chain by using a unique_ptr. PR-URL: #23113 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
This commit removes the goto statements in SSL_CTX_use_certificate_chain by using a unique_ptr. PR-URL: #23113 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
This commit removes the goto statements in SSL_CTX_use_certificate_chain by using a unique_ptr. PR-URL: #23113 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
This commit removes the goto statements in SSL_CTX_use_certificate_chain
by using a unique_ptr.
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes