]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: Lua: The socket may be destroyed when we try to access.
authorThierry FOURNIER <thierry.fournier@ozon.io>
Tue, 11 Jul 2017 16:38:39 +0000 (18:38 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 11 Sep 2017 16:59:40 +0000 (18:59 +0200)
When we try to access to other proxy context, we must check
its existence because haproxy can kill it between the creation
and the usage.

This patch should be backported in 1.6 and 1.7

src/hlua.c

index 24e04f20d4eb62b8ade2d16d41aa5854fa773752..4299487155da5577f55c99316b4fc8f774b92f16 100644 (file)
@@ -2205,6 +2205,11 @@ __LJMP static int hlua_socket_connect(struct lua_State *L)
 
        /* Get args. */
        socket  = MAY_LJMP(hlua_checksocket(L, 1));
+
+       /* The socket may be destroy. */
+       if (!socket->s)
+               return 0;
+
        ip      = MAY_LJMP(luaL_checkstring(L, 2));
        if (lua_gettop(L) >= 3)
                port = MAY_LJMP(luaL_checkinteger(L, 3));