Skip to content

Commit 79d647d

Browse files
committed
crypto: fix legacy SNICallback
`onselect` is set on the `sniObject_` not on the `Connection` instance. See: nodejs/node-v0.x-archive#25109
1 parent 6edc900 commit 79d647d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/node_crypto.cc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2266,8 +2266,15 @@ int Connection::SelectSNIContextCallback_(SSL *s, int *ad, void* arg) {
22662266
if (!conn->sniObject_.IsEmpty()) {
22672267
conn->sni_context_.Reset();
22682268

2269+
Local<Object> sni_obj = PersistentToLocal(env->isolate(),
2270+
conn->sniObject_);
2271+
22692272
Local<Value> arg = PersistentToLocal(env->isolate(), conn->servername_);
2270-
Local<Value> ret = conn->MakeCallback(env->onselect_string(), 1, &arg);
2273+
Local<Value> ret = node::MakeCallback(env->isolate(),
2274+
sni_obj,
2275+
env->onselect_string(),
2276+
1,
2277+
&arg);
22712278

22722279
// If ret is SecureContext
22732280
Local<FunctionTemplate> secure_context_constructor_template =

0 commit comments

Comments
 (0)