diff --git a/mesecons_luacontroller/init.lua b/mesecons_luacontroller/init.lua index 72bee24..0ee2def 100644 --- a/mesecons_luacontroller/init.lua +++ b/mesecons_luacontroller/init.lua @@ -238,6 +238,16 @@ local function safe_string_find(...) return string.find(...) end +-- do not allow pattern matching in string.split (see string.find for details) +local function safe_string_split(...) + if select(5, ...) then + debug.sethook() -- Clear hook + error("string.split: 'sep_is_pattern' (fifth parameter) may not be used in a Luacontroller") + end + + return string.split(...) +end + local function remove_functions(x) local tp = type(x) if tp == "function" then @@ -507,6 +517,7 @@ local function create_environment(pos, mem, event, itbl, send_warning) reverse = string.reverse, sub = string.sub, find = safe_string_find, + split = safe_string_split, }, math = { abs = math.abs,