mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 06:21:28 +00:00
More selective filtering of lua libs, seed random set for lua interpreter, Release Canidate
This commit is contained in:
parent
e42c7a38a5
commit
2c68e813e9
@ -780,12 +780,40 @@ void LuaParser::ReloadQuests() {
|
||||
AddError(error);
|
||||
}
|
||||
|
||||
#ifdef SANITIZE_LUA_LIBS
|
||||
lua_pushnil(L);
|
||||
lua_setglobal(L, "os");
|
||||
if(luaL_dostring(L, "math.randomseed(os.time())")) {
|
||||
std::string error = lua_tostring(L, -1);
|
||||
AddError(error);
|
||||
}
|
||||
|
||||
#ifdef SANITIZE_LUA_LIBS
|
||||
//io
|
||||
lua_pushnil(L);
|
||||
lua_setglobal(L, "io");
|
||||
|
||||
//some os/debug are okay some are not
|
||||
lua_getglobal(L, "os");
|
||||
lua_pushnil(L);
|
||||
lua_setfield(L, -2, "exit");
|
||||
lua_pushnil(L);
|
||||
lua_setfield(L, -2, "execute");
|
||||
lua_pushnil(L);
|
||||
lua_setfield(L, -2, "getenv");
|
||||
lua_pushnil(L);
|
||||
lua_setfield(L, -2, "remove");
|
||||
lua_pushnil(L);
|
||||
lua_setfield(L, -2, "rename");
|
||||
lua_pushnil(L);
|
||||
lua_setfield(L, -2, "setlocale");
|
||||
lua_pushnil(L);
|
||||
lua_setfield(L, -2, "tmpname");
|
||||
lua_pop(L, 1);
|
||||
|
||||
lua_pushnil(L);
|
||||
lua_setglobal(L, "collectgarbage");
|
||||
|
||||
lua_pushnil(L);
|
||||
lua_setglobal(L, "loadfile");
|
||||
|
||||
#endif
|
||||
|
||||
lua_getglobal(L, "package");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user