]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: lua: use correct object size when initializing a new converter
authorWilly Tarreau <w@1wt.eu>
Mon, 6 Apr 2015 08:50:55 +0000 (10:50 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 6 Apr 2015 08:54:36 +0000 (10:54 +0200)
In hlua_converters_new(), we used to allocate the size of an hlua_txn
instead of hlua_smp, resulting in random crashes with one integer being
randomly overwritten at the end, even when no converter is being used.

src/hlua.c

index c6dcd896e41cb0ffe92bb9c55592e67221071396..d764fa55f50faa0282c3252e49a5f3b328d931b0 100644 (file)
@@ -2813,7 +2813,7 @@ static int hlua_converters_new(lua_State *L, struct hlua_txn *txn, int stringsaf
         * same than the TXN object.
         */
        lua_newtable(L);
-       hs = lua_newuserdata(L, sizeof(struct hlua_txn));
+       hs = lua_newuserdata(L, sizeof(struct hlua_smp));
        lua_rawseti(L, -2, 0);
 
        hs->s = txn->s;