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 1/2] 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 From 8ad1cafb07c239d383850053fb5bfd5c6c4bf0af Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 10 Jan 2023 04:51:59 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- library/LuaTools.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/LuaTools.cpp b/library/LuaTools.cpp index 618fb1fea..b4d009c7b 100644 --- a/library/LuaTools.cpp +++ b/library/LuaTools.cpp @@ -1901,7 +1901,7 @@ lua_State *DFHack::Lua::Open(color_ostream &out, lua_State *state) 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);