]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
map: stricter argument checking
authorPetr Špaček <petr.spacek@nic.cz>
Tue, 13 Oct 2020 15:05:59 +0000 (17:05 +0200)
committerTomas Krizek <tomas.krizek@nic.cz>
Mon, 26 Oct 2020 13:25:13 +0000 (14:25 +0100)
daemon/lua/sandbox.lua.in

index 63d94c3c01a0cd5a8b65e4c446c8912e1ec71613..6cdaaa51a0b2b198843eaf984bf501b586c9ef73 100644 (file)
@@ -654,10 +654,12 @@ function map(cmd, format)
        local results = {}
 
        format = format or 'luaobj'
-       if format ~= 'luaobj' and format ~= 'strings' then
-               warn('warning: Unknown map format. Used "luaobj".')
-               format = 'luaobj'
-       end
+       if (type(cmd) ~= 'string') then
+               panic('map() command must be a string') end
+       if (#cmd <= 0) then
+               panic('map() command must be non-empty') end
+       if (format ~= 'luaobj' and format ~= 'strings') then
+               panic('map() output format must be luaobj or strings') end
 
        for _,v in pairs(net.list()) do
                if (v['kind'] == 'control') and (v['transport']['family'] == 'unix') then