From: Petr Špaček Date: Tue, 20 Oct 2020 12:30:40 +0000 (+0200) Subject: map: disallow commands with \n X-Git-Tag: v5.2.0~6^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6246d3a38cb09cd039764c9fc5947d9974ef2fb5;p=thirdparty%2Fknot-resolver.git map: disallow commands with \n Control protocol uses \n as command delimiter so we cannot allow \n inside commands. Users should be able to Lua-escape \n with \010. --- diff --git a/daemon/lua/sandbox.lua.in b/daemon/lua/sandbox.lua.in index e08c69b53..f7c2afd38 100644 --- a/daemon/lua/sandbox.lua.in +++ b/daemon/lua/sandbox.lua.in @@ -744,6 +744,8 @@ function map(cmd, format) if (type(cmd) ~= 'string') then panic('map() command must be a string') end + if string.find(cmd, '\n', 1, true) then + panic('map() command cannot contain literal \\n, escape it with \\010') end if (#cmd <= 0) then panic('map() command must be non-empty') end -- syntax check on input command to detect typos early