From d725b813c750df8f0aa6abf73e1014f4e31894fb Mon Sep 17 00:00:00 2001 From: arekatir <120872617+arekatir@users.noreply.github.com> Date: Mon, 9 Jan 2023 23:04:43 -0500 Subject: [PATCH] Remove os.execute and io.popen --- library/LuaTools.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/library/LuaTools.cpp b/library/LuaTools.cpp index c76c65651..618fb1fea 100644 --- a/library/LuaTools.cpp +++ b/library/LuaTools.cpp @@ -1896,9 +1896,17 @@ lua_State *DFHack::Lua::Open(color_ostream &out, lua_State *state) luaL_setfuncs(state, dfhack_coro_funcs, 0); lua_pop(state, 1); + // replace some io functions + lua_getglobal(state, "io"); + lua_pushnil(state); + lua_setfield(state, -2, "popen"); + lua_pop(state, 1); + // replace some os functions lua_getglobal(state, "os"); luaL_setfuncs(state, dfhack_os_funcs, 0); + lua_pushnil(state); + lua_setfield(state, -2, "execute"); lua_pop(state, 1); // split the global environment