From 3b16526ad6481454b55cde1a4914bdca43bd6210 Mon Sep 17 00:00:00 2001 From: gresham Date: Thu, 28 May 2026 20:41:44 +0800 Subject: [PATCH] bugfix: stream cosocket getsslctx() bound to wrong FFI symbol. The stream branch in lib/resty/core/socket.lua bound ngx_lua_ffi_socket_getsslctx to ngx_stream_lua_ffi_socket_tcp_get_ssl_pointer (a copy/paste of the getsslpointer block above). As a result, stream cosocket:getsslctx() returned an SSL* while callers used it as SSL_CTX*, leading to undefined behavior. Bind to ngx_stream_lua_ffi_socket_tcp_get_ssl_ctx instead, matching the http branch. --- lib/resty/core/socket.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/resty/core/socket.lua b/lib/resty/core/socket.lua index ea973b7ba..690cd3808 100644 --- a/lib/resty/core/socket.lua +++ b/lib/resty/core/socket.lua @@ -150,9 +150,9 @@ then ngx_lua_ffi_socket_getsslpointer = C.ngx_stream_lua_ffi_socket_tcp_get_ssl_pointer end -if pcall(function() return C.ngx_stream_lua_ffi_socket_tcp_get_ssl_pointer end) +if pcall(function() return C.ngx_stream_lua_ffi_socket_tcp_get_ssl_ctx end) then -ngx_lua_ffi_socket_getsslctx = C.ngx_stream_lua_ffi_socket_tcp_get_ssl_pointer +ngx_lua_ffi_socket_getsslctx = C.ngx_stream_lua_ffi_socket_tcp_get_ssl_ctx end if pcall(function()