crypto: check SecureContext existence#16964
Closed
sam-github wants to merge 1 commit intonodejs:masterfrom
Closed
Conversation
addaleax
approved these changes
Nov 12, 2017
Member
addaleax
left a comment
There was a problem hiding this comment.
By the way, we usually prefer explicit nullptr checks, i.e. CHECK_NE(sc, nullptr);
cjihrig
approved these changes
Nov 12, 2017
Contributor
Author
|
Hah, can you tell we're in the same timezone still, Anna? :-) |
Fix:
*** CID 179169: Null pointer dereferences (NULL_RETURNS)
/src/node_crypto.cc: 1353 in node::crypto::SecureContext::SetClientCertEngine(const v8::FunctionCallbackInfo<v8::Value> &)()
1347
1348 // SSL_CTX_set_client_cert_engine does not itself support multiple
1349 // calls by cleaning up before overwriting the client_cert_engine
1350 // internal context variable.
1351 // Instead of trying to fix up this problem we in turn also do not
1352 // support multiple calls to SetClientCertEngine.
>>> CID 179169: Null pointer dereferences (NULL_RETURNS)
>>> Dereferencing a null pointer "sc".
1353 if (sc->client_cert_engine_provided_) {
1354 return env->ThrowError(
1355 "Multiple calls to SetClientCertEngine are not allowed");
1356 }
1357
1358 const node::Utf8Value engine_id(env->isolate(), args[0]);
b56cb16 to
8fbbb34
Compare
Contributor
Author
|
Rewrote as |
Member
|
@sam-github have a safe trip home! |
Member
|
Oh, hah... #16965. Guess I should have checked my github notifications first.
|
4 tasks
jasnell
approved these changes
Nov 12, 2017
Member
Contributor
Author
|
No problem, thanks Ben. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SecureContext should always be present,
CHECK()it, on theory an explicit crash is better than one due to null pointer deref (if that is even reachable).@cjihrig @bnoordhuis ?
Fix:
*** CID 179169: Null pointer dereferences (NULL_RETURNS)
/src/node_crypto.cc: 1353 in node::crypto::SecureContext::SetClientCertEngine(const v8::FunctionCallbackInfov8::Value &)()
1347
1348 // SSL_CTX_set_client_cert_engine does not itself support multiple
1349 // calls by cleaning up before overwriting the client_cert_engine
1350 // internal context variable.
1351 // Instead of trying to fix up this problem we in turn also do not
1352 // support multiple calls to SetClientCertEngine.
1353 if (sc->client_cert_engine_provided_) {
1354 return env->ThrowError(
1355 "Multiple calls to SetClientCertEngine are not allowed");
1356 }
1357
1358 const node::Utf8Value engine_id(env->isolate(), args[0]);
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)