From: Thierry FOURNIER Date: Sun, 6 Jan 2019 18:38:49 +0000 (+0100) Subject: BUG/MINOR: lua: bad args are returned for Lua actions X-Git-Tag: v2.0-dev1~257 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1725c2e3951d4eeae136125f417c620fa0ed3847;p=thirdparty%2Fhaproxy.git BUG/MINOR: lua: bad args are returned for Lua actions In tcp actions case, the argument n - 1 is returned. For example: http-request lua.script stuff display "stuff" as first arg tcp-request content lua.script stuff display "lua.script" as first arg The action parser doesn't use the *cur_arg value. Thanks to Andy Franks for the bug report. This patch mist be backported in haproxy-1.8 and haproxy-1.9 --- diff --git a/src/hlua.c b/src/hlua.c index a3886cfaae..fcedac6719 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -7641,11 +7641,11 @@ static enum act_parse_ret action_register_lua(const char **args, int *cur_arg, s /* Expect some arguments */ for (i = 0; i < fcn->nargs; i++) { - if (*args[i+1] == '\0') { + if (*args[*cur_arg] == '\0') { memprintf(err, "expect %d arguments", fcn->nargs); return ACT_RET_PRS_ERR; } - rule->arg.hlua_rule->args[i] = strdup(args[i + 1]); + rule->arg.hlua_rule->args[i] = strdup(args[*cur_arg]); if (!rule->arg.hlua_rule->args[i]) { memprintf(err, "out of memory error"); return ACT_RET_PRS_ERR;