From: Olivier Houchard Date: Mon, 12 Sep 2022 22:35:53 +0000 (+0200) Subject: BUG/MEDIUM: lua: handle stick table implicit arguments right. X-Git-Tag: v2.7-dev8~70 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=14f62688839dc7245ca87e040f14fbd2147698e6;p=thirdparty%2Fhaproxy.git BUG/MEDIUM: lua: handle stick table implicit arguments right. In hlua_lua2arg_check(), we allow for the first argument to not be provided, if it has a type we know, this is true for frontend, backend, and stick table. However, the stick table code was changed. It used to be deduced from the proxy, but it is now directly provided in struct args. So setting the proxy there no longer work, and we have to explicitely set the stick table. Not doing so will lead the code do use the proxy pointer as a stick table pointer, which will likely cause crashes. This should be backported up to 2.0. --- diff --git a/src/hlua.c b/src/hlua.c index cc2e6a6e23..ee48f5c92f 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -860,7 +860,11 @@ __LJMP int hlua_lua2arg_check(lua_State *L, int first, struct arg *argp, break; case ARGT_TAB: - argp[idx].data.prx = p; + if (!p->table) { + msg = "Mandatory argument expected"; + goto error; + } + argp[idx].data.t = p->table; argp[idx].type = ARGT_TAB; argp[idx+1].type = ARGT_STOP; break;