From: Thierry Fournier Date: Sun, 29 Nov 2020 00:06:24 +0000 (+0100) Subject: BUG/MINOR: lua: lua-load doesn't check its parameters X-Git-Tag: v2.3.3~66 X-Git-Url: http://git.haproxy.org/?a=commitdiff_plain;h=ad6e9c5e4f1d815dbac0861458c4f228ca2d4a01;p=haproxy-2.3.git BUG/MINOR: lua: lua-load doesn't check its parameters "lua-load" doesn't check if the expected parameter is present. It tries to open() directly the argument at second position. So if the filename is omitted, it tries to load an empty filename. This patch could be backported until 1.8 (cherry picked from commit 77a88943d6a0d7852c25a03541d60ccf44aa5c6d) Signed-off-by: Christopher Faulet --- diff --git a/src/hlua.c b/src/hlua.c index 1ecf0c1..49db0f3 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -7986,6 +7986,11 @@ static int hlua_load(char **args, int section_type, struct proxy *curpx, { int error; + if (*(args[1]) == 0) { + memprintf(err, "'%s' expects a file name as parameter.\n", args[0]); + return -1; + } + /* Just load and compile the file. */ error = luaL_loadfile(gL.T, args[1]); if (error) {