Nuke function 'loadfile' for sandboxing reasons'
This commit is contained in:
@@ -70,14 +70,18 @@ static void load_builtin_class(lua_State *L, const char *name, lua_CFunction fun
|
||||
}
|
||||
|
||||
static void source_install_builtins(lua_State *L) {
|
||||
LuaVar nullstring, stringclass;
|
||||
LuaStack LS(L, nullstring, stringclass);
|
||||
LuaVar nullstring, stringclass, globtab;
|
||||
LuaStack LS(L, nullstring, stringclass, globtab);
|
||||
luaopen_base(L);
|
||||
load_builtin_class(L, "table", luaopen_table);
|
||||
load_builtin_class(L, "string", luaopen_string);
|
||||
load_builtin_class(L, "math", luaopen_math);
|
||||
load_builtin_class(L, "debug", luaopen_debug);
|
||||
|
||||
// Nuke a few of the builtin functions for sandboxing reasons.
|
||||
LS.getglobaltable(globtab);
|
||||
LS.rawset(globtab, "loadfile", LuaNil);
|
||||
|
||||
// Set the metatable for strings.
|
||||
// Normally, this would be done by luaopen_string, but we're
|
||||
// messing with the tables so we have to redo it.
|
||||
|
||||
Reference in New Issue
Block a user