From cba5a923f83f9345693ae85a8181115fec5d30f1 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Tue, 31 Jan 2017 14:25:29 +0100 Subject: [PATCH] lua: make the map command check its arguments Fixes #147. --- daemon/engine.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/daemon/engine.c b/daemon/engine.c index 9b53b1bc9..21cf15904 100644 --- a/daemon/engine.c +++ b/daemon/engine.c @@ -376,6 +376,11 @@ static int l_tojson(lua_State *L) static int l_map(lua_State *L) { + if (lua_gettop(L) != 1 || !lua_isstring(L, 1)) { + lua_pushliteral(L, "map('string with a lua expression')"); + lua_error(L); + } + struct engine *engine = engine_luaget(L); const char *cmd = lua_tostring(L, 1); uint32_t len = strlen(cmd); -- 2.47.2