Fix the gsub for to limit to allowed characters
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
--add the copy function
|
||||
function copy(src,dst)
|
||||
--retrieve allowed characters and then use it to sanitize the dir variable
|
||||
local allowed_chars = os.getenv("ALLOWED_CHARS") or "^%a%d%-%._~/"
|
||||
dir = dir:gsub("[^" .. allowed_chars .. "]", "")
|
||||
local allowed_chars = os.getenv("ALLOWED_CHARS") or "^%a%d%-%._~/";
|
||||
src = src:gsub("[^" .. allowed_chars .. "]", "");
|
||||
dst = dst:gsub("[^" .. allowed_chars .. "]", "");
|
||||
|
||||
if (package.config:sub(1,1) == "/") then
|
||||
--unix
|
||||
@@ -15,4 +16,4 @@
|
||||
end
|
||||
os.execute(cmd);
|
||||
return cmd;
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user