diff options
author | cjihrig <cjihrig@gmail.com> | 2018-11-03 18:24:50 +0300 |
---|---|---|
committer | Beth Griggs <Bethany.Griggs@uk.ibm.com> | 2019-07-16 19:38:02 +0300 |
commit | f9e8e8856ab34cd054cd575e0a8a345ff1d521eb (patch) | |
tree | 2ed2cfa6d3d7937625a59f45f03c66336ea07f52 /src | |
parent | b689008deadd1f1b323c2fe808829dcc9a795291 (diff) |
src: fix Get() usage in tls_wrap.cc
Backport-PR-URL: https://github.com/nodejs/node/pull/27967
PR-URL: https://github.com/nodejs/node/pull/24060
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/tls_wrap.cc | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc index 1c7c32fb8f9..7dcf9d5f8a0 100644 --- a/src/tls_wrap.cc +++ b/src/tls_wrap.cc @@ -221,8 +221,10 @@ void TLSWrap::SSLInfoCallback(const SSL* ssl_, int where, int ret) { Local<Object> object = c->object(); if (where & SSL_CB_HANDSHAKE_START) { - Local<Value> callback = object->Get(env->onhandshakestart_string()); - if (callback->IsFunction()) { + Local<Value> callback; + + if (object->Get(env->context(), env->onhandshakestart_string()) + .ToLocal(&callback) && callback->IsFunction()) { Local<Value> argv[] = { env->GetNow() }; c->MakeCallback(callback.As<Function>(), arraysize(argv), argv); } @@ -232,9 +234,12 @@ void TLSWrap::SSLInfoCallback(const SSL* ssl_, int where, int ret) { // sending HelloRequest in OpenSSL-1.1.1. // We need to check whether this is in a renegotiation state or not. if (where & SSL_CB_HANDSHAKE_DONE && !SSL_renegotiate_pending(ssl)) { + Local<Value> callback; + c->established_ = true; - Local<Value> callback = object->Get(env->onhandshakedone_string()); - if (callback->IsFunction()) { + + if (object->Get(env->context(), env->onhandshakedone_string()) + .ToLocal(&callback) && callback->IsFunction()) { c->MakeCallback(callback.As<Function>(), 0, nullptr); } } @@ -845,7 +850,10 @@ int TLSWrap::SelectSNIContextCallback(SSL* s, int* ad, void* arg) { // Call the SNI callback and use its return value as context Local<Object> object = p->object(); - Local<Value> ctx = object->Get(env->sni_context_string()); + Local<Value> ctx; + + if (!object->Get(env->context(), env->sni_context_string()).ToLocal(&ctx)) + return SSL_TLSEXT_ERR_NOACK; // Not an object, probably undefined or null if (!ctx->IsObject()) |