mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 10:31:29 +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);
|
AddError(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SANITIZE_LUA_LIBS
|
if(luaL_dostring(L, "math.randomseed(os.time())")) {
|
||||||
lua_pushnil(L);
|
std::string error = lua_tostring(L, -1);
|
||||||
lua_setglobal(L, "os");
|
AddError(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef SANITIZE_LUA_LIBS
|
||||||
|
//io
|
||||||
lua_pushnil(L);
|
lua_pushnil(L);
|
||||||
lua_setglobal(L, "io");
|
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
|
#endif
|
||||||
|
|
||||||
lua_getglobal(L, "package");
|
lua_getglobal(L, "package");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user