[0.11.3] Lua leaks computers account name/data path
Posted: Tue Nov 25, 2014 2:21 pm
Im not terribly good at Lua so I have no idea if this is an issue with how lua is done or if this is an issue with serpent getting the bytecode for a function in a higher context than the mod is run in however:
This is the least amount of code I could get it to work with
When it prints out the result of that it gives a string pointing to the path of the mod:
Now, im not sure how "bad" this is or if something else is going on here. I mean its not a major issue, just something that might want to be looked into. I found this whilst debugging a mod which runs lua scripts in computers in game so would be thankful if you didn't just remove pcall or load and could find a different way of sorting this out (if it needs to be).
Thanks!
This is the least amount of code I could get it to work with
Code: Select all
local test = {};
function test:new ()
return {};
end
function test:print ()
end
local p,s = pcall(load("return _ENV;", nil, "t", { test:new(), test }));
local path = string.match(serpent.line(s), ".-/(.-)|.*")
game.player.print(path);
When it prints out the result of that it gives a string pointing to the path of the mod:
Now, im not sure how "bad" this is or if something else is going on here. I mean its not a major issue, just something that might want to be looked into. I found this whilst debugging a mod which runs lua scripts in computers in game so would be thankful if you didn't just remove pcall or load and could find a different way of sorting this out (if it needs to be).
Thanks!