mirror of
http://git.haproxy.org/git/haproxy.git
synced 2026-02-05 04:53:23 +02:00
BUG/MINOR: hlua_fcn: ensure Patref:add_bulk() is given a table object before using it
As reported by GH user @kanashimia in GH #3241, providing anything else
than a table to Patref:add_bulk() method could cause a segfault because
we were calling lua_next() with the lua object without ensuring it
actually is a table.
Let's add the missing lua_istable() check on the stack object before
calling lua_next() function on it.
It should be backported up to 3.2 with 884dc62 ("MINOR: hlua_fcn:
add Patref:add_bulk()")
This commit is contained in:
@@ -2796,6 +2796,11 @@ static int _hlua_patref_add_bulk(lua_State *L, int status, lua_KContext ctx)
|
||||
int count = 0;
|
||||
int ret;
|
||||
|
||||
if (!lua_istable(L, 2)) {
|
||||
luaL_argerror(L, 2, "argument is expected to be a table");
|
||||
return 0; // not reached
|
||||
}
|
||||
|
||||
if ((ref->flags & HLUA_PATREF_FL_GEN) &&
|
||||
pat_ref_may_commit(ref->ptr, ref->curr_gen))
|
||||
curr_gen = ref->curr_gen;
|
||||
|
||||
Reference in New Issue
Block a user