Use safe_string_spit function

This commit is contained in:
Lejo 2020-01-03 12:01:23 +01:00 committed by GitHub
parent f1ff092770
commit 0c9fe6a9aa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -231,6 +231,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
@ -463,7 +473,7 @@ local function create_environment(pos, mem, event, itbl, send_warning)
reverse = string.reverse,
sub = string.sub,
find = safe_string_find,
split = string.split,
split = safe_string_split,
},
math = {
abs = math.abs,