GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — src: fix TLSWrap lifetime bug in ALPN callback · nodejs/node@62e2e59

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • src/crypto
    • crypto_tls.cc
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/crypto/crypto_tls.cc‎

Copy file name to clipboardExpand all lines: src/crypto/crypto_tls.cc
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ int SelectALPNCallback(
223223
const unsigned char* in,
224224
unsigned int inlen,
225225
void* arg) {
226-
TLSWrap* w = static_cast<TLSWrap*>(arg);
226+
TLSWrap* w = static_cast<TLSWrap*>(SSL_get_app_data(s));
227227
if (w->alpn_callback_enabled_) {
228228
Environment* env = w->env();
229229
HandleScope handle_scope(env->isolate());
@@ -1293,7 +1293,8 @@ void TLSWrap::EnableALPNCb(const FunctionCallbackInfo<Value>& args) {
12931293
wrap->alpn_callback_enabled_ = true;
12941294

12951295
SSL* ssl = wrap->ssl_.get();
1296-
SSL_CTX_set_alpn_select_cb(SSL_get_SSL_CTX(ssl), SelectALPNCallback, wrap);
1296+
SSL_CTX* ssl_ctx = SSL_get_SSL_CTX(ssl);
1297+
SSL_CTX_set_alpn_select_cb(ssl_ctx, SelectALPNCallback, nullptr);
12971298
}
12981299

12991300
void TLSWrap::GetServername(const FunctionCallbackInfo<Value>& args) {
@@ -1589,7 +1590,8 @@ void TLSWrap::SetALPNProtocols(const FunctionCallbackInfo<Value>& args) {
15891590
} else {
15901591
w->alpn_protos_ = std::vector<unsigned char>(
15911592
protos.data(), protos.data() + protos.length());
1592-
SSL_CTX_set_alpn_select_cb(SSL_get_SSL_CTX(ssl), SelectALPNCallback, w);
1593+
SSL_CTX* ssl_ctx = SSL_get_SSL_CTX(ssl);
1594+
SSL_CTX_set_alpn_select_cb(ssl_ctx, SelectALPNCallback, nullptr);
15931595
}
15941596
}
15951597

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.