Skip to content

Commit 90fb633

Browse files
authored
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.
1 parent 1c5796e commit 90fb633

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/resty/core/socket.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,9 @@ then
150150
ngx_lua_ffi_socket_getsslpointer =
151151
C.ngx_stream_lua_ffi_socket_tcp_get_ssl_pointer
152152
end
153-
if pcall(function() return C.ngx_stream_lua_ffi_socket_tcp_get_ssl_pointer end)
153+
if pcall(function() return C.ngx_stream_lua_ffi_socket_tcp_get_ssl_ctx end)
154154
then
155-
ngx_lua_ffi_socket_getsslctx = C.ngx_stream_lua_ffi_socket_tcp_get_ssl_pointer
155+
ngx_lua_ffi_socket_getsslctx = C.ngx_stream_lua_ffi_socket_tcp_get_ssl_ctx
156156
end
157157

158158
if pcall(function()

0 commit comments

Comments
 (0)