mirror of
https://github.com/brunoos/luasec.git
synced 2024-12-27 12:58:21 +01:00
Update reference to Lua state prior to handshake
The Lua thread that creates the context is saved to be used for accessing callback related data. However that thread may become garbage and its memory could be overwritten with anything if the handshake happens later, in a different thread. Fixes #75 Thanks @Zash
This commit is contained in:
parent
dea60edf4f
commit
d4ea2d12f3
@ -382,9 +382,11 @@ static int meth_setfd(lua_State *L)
|
||||
*/
|
||||
static int meth_handshake(lua_State *L)
|
||||
{
|
||||
int err;
|
||||
p_ssl ssl = (p_ssl)luaL_checkudata(L, 1, "SSL:Connection");
|
||||
int err = handshake(ssl);
|
||||
p_context ctx = (p_context)SSL_CTX_get_app_data(SSL_get_SSL_CTX(ssl->ssl));
|
||||
ctx->L = L;
|
||||
err = handshake(ssl);
|
||||
if (ctx->dh_param) {
|
||||
DH_free(ctx->dh_param);
|
||||
ctx->dh_param = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user