Skip to content
Permalink
Browse files

src: fix Get() usage in tls_wrap.cc

Backport-PR-URL: #27967
PR-URL: #24060
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
  • Loading branch information...
cjihrig authored and BethGriggs committed Nov 3, 2018
1 parent b689008 commit f9e8e8856ab34cd054cd575e0a8a345ff1d521eb
Showing with 13 additions and 5 deletions.
  1. +13 −5 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())

0 comments on commit f9e8e88

Please sign in to comment.
You can’t perform that action at this time.