forked from criblio/js2bin
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Apply node tls crash patch fix found here: nodejs/node#49635
- Loading branch information
Showing
2 changed files
with
43 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
From 1643adf771dafce8034a00faacf98a2e57d5eebc Thu Oct 5 01:40:07 2023 | ||
fixes TLS segfault crash | ||
|
||
--- a/src/crypto/crypto_tls.cc | ||
+++ b/src/crypto/crypto_tls.cc | ||
@@ -223,7 +223,7 @@ int SelectALPNCallback( | ||
const unsigned char* in, | ||
unsigned int inlen, | ||
void* arg) { | ||
- TLSWrap* w = static_cast<TLSWrap*>(arg); | ||
+ TLSWrap* w = static_cast<TLSWrap*>(SSL_get_app_data(s)); | ||
if (w->alpn_callback_enabled_) { | ||
Environment* env = w->env(); | ||
HandleScope handle_scope(env->isolate()); | ||
@@ -1293,7 +1293,8 @@ void TLSWrap::EnableALPNCb(const FunctionCallbackInfo<Value>& args) { | ||
wrap->alpn_callback_enabled_ = true; | ||
|
||
SSL* ssl = wrap->ssl_.get(); | ||
- SSL_CTX_set_alpn_select_cb(SSL_get_SSL_CTX(ssl), SelectALPNCallback, wrap); | ||
+ SSL_CTX* ssl_ctx = SSL_get_SSL_CTX(ssl); | ||
+ SSL_CTX_set_alpn_select_cb(ssl_ctx, SelectALPNCallback, nullptr); | ||
} | ||
|
||
void TLSWrap::GetServername(const FunctionCallbackInfo<Value>& args) { | ||
@@ -1589,7 +1590,8 @@ void TLSWrap::SetALPNProtocols(const FunctionCallbackInfo<Value>& args) { | ||
} else { | ||
w->alpn_protos_ = std::vector<unsigned char>( | ||
protos.data(), protos.data() + protos.length()); | ||
- SSL_CTX_set_alpn_select_cb(SSL_get_SSL_CTX(ssl), SelectALPNCallback, w); | ||
+ SSL_CTX* ssl_ctx = SSL_get_SSL_CTX(ssl); | ||
+ SSL_CTX_set_alpn_select_cb(ssl_ctx, SelectALPNCallback, nullptr); | ||
} | ||
} | ||
|