diff options
author | Brian White <mscdex@mscdex.net> | 2018-06-27 03:08:06 -0400 |
---|---|---|
committer | Brian White <mscdex@mscdex.net> | 2018-07-03 16:30:30 -0400 |
commit | a15ea5d7ca1cf0f48ce1f2be62b1cd446a50b06d (patch) | |
tree | 7cdcd757f342831856bb184fe3ad301488902efe /src | |
parent | c267639daa0cc0ef55501fcdc8c385292a9ed927 (diff) | |
download | android-node-v8-a15ea5d7ca1cf0f48ce1f2be62b1cd446a50b06d.tar.gz android-node-v8-a15ea5d7ca1cf0f48ce1f2be62b1cd446a50b06d.tar.bz2 android-node-v8-a15ea5d7ca1cf0f48ce1f2be62b1cd446a50b06d.zip |
tls: throw error on bad ciphers option
PR-URL: https://github.com/nodejs/node/pull/21557
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/node_crypto.cc | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 818311edde..31abeec6f3 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -904,7 +904,13 @@ void SecureContext::SetCiphers(const FunctionCallbackInfo<Value>& args) { THROW_AND_RETURN_IF_NOT_STRING(env, args[0], "Ciphers"); const node::Utf8Value ciphers(args.GetIsolate(), args[0]); - SSL_CTX_set_cipher_list(sc->ctx_.get(), *ciphers); + if (!SSL_CTX_set_cipher_list(sc->ctx_.get(), *ciphers)) { + unsigned long err = ERR_get_error(); // NOLINT(runtime/int) + if (!err) { + return env->ThrowError("Failed to set ciphers"); + } + return ThrowCryptoError(env, err); + } } |