Skip to content
This repository was archived by the owner on Aug 31, 2018. It is now read-only.

Commit ffc2506

Browse files
jasnelladdaleax
authored andcommitted
crypto: use CHECK instead in getSSLCiphers
The previous throws should never happen, and if they do, they signal a larger issue in core. Make these checks rather than throws. PR-URL: nodejs/node#16453 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent 5f88e06 commit ffc2506

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/node_crypto.cc

+2-7
Original file line numberDiff line numberDiff line change
@@ -5629,15 +5629,10 @@ void GetSSLCiphers(const FunctionCallbackInfo<Value>& args) {
56295629
Environment* env = Environment::GetCurrent(args);
56305630

56315631
SSL_CTX* ctx = SSL_CTX_new(TLSv1_server_method());
5632-
if (ctx == nullptr) {
5633-
return env->ThrowError("SSL_CTX_new() failed.");
5634-
}
5632+
CHECK_NE(ctx, nullptr);
56355633

56365634
SSL* ssl = SSL_new(ctx);
5637-
if (ssl == nullptr) {
5638-
SSL_CTX_free(ctx);
5639-
return env->ThrowError("SSL_new() failed.");
5640-
}
5635+
CHECK_NE(ssl, nullptr);
56415636

56425637
Local<Array> arr = Array::New(env->isolate());
56435638
STACK_OF(SSL_CIPHER)* ciphers = SSL_get_ciphers(ssl);

0 commit comments

Comments
 (0)