Skip to content

Commit ff2a8d6

Browse files
Revert "debug.getregistry() now only retrieves whitelisted members"
This reverts commit 8455dde.
1 parent 8455dde commit ff2a8d6

File tree

3 files changed

+0
-25
lines changed

3 files changed

+0
-25
lines changed

Server/mods/deathmatch/logic/lua/CLuaMain.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,6 @@ void CLuaMain::InitSecurity ( void )
129129
lua_register ( m_luaVM, "loadfile", CLuaUtilDefs::DisabledFunction );
130130
lua_register ( m_luaVM, "getfenv", CLuaUtilDefs::DisabledFunction );
131131
lua_register ( m_luaVM, "newproxy", CLuaUtilDefs::DisabledFunction );
132-
133-
// Wrap debug.getregistry to make it safe.
134-
lua_getglobal(m_luaVM, "debug"); // stack: [tbl_debug]
135-
lua_pushstring(m_luaVM, "getregistry"); // stack: [tbl_debug,"getregistry"]
136-
lua_pushcfunction(m_luaVM, CLuaUtilDefs::Debug_getregistry); // stack: [tbl_debug,"getregistry",CLuaUtilDefs::Debug_getregistry]
137-
lua_rawset(m_luaVM, -3); // stack: [tbl_debug]
138-
lua_pop(m_luaVM, -1); // stack: []
139132
}
140133

141134

Shared/mods/deathmatch/logic/luadefs/CLuaUtilDefs.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -48,23 +48,6 @@ int CLuaUtilDefs::DisabledFunction ( lua_State* luaVM )
4848
return 1;
4949
}
5050

51-
52-
// Get a copy of the registry with whitelisted values
53-
int CLuaUtilDefs::Debug_getregistry(lua_State* luaVM)
54-
{
55-
// Create a new registry library, with only whitelisted sections
56-
lua_newtable(luaVM); // stack: [tbl_new]
57-
std::vector<const char*> szWhitelist = { "ud", "mt" };
58-
for (auto it = szWhitelist.begin(); it != szWhitelist.end(); it++)
59-
{
60-
lua_pushstring(luaVM, *it); // stack: [tbl_new,"ud"]
61-
lua_pushstring(luaVM, *it); // stack: [tbl_new,"ud","ud"]
62-
lua_gettable(luaVM, LUA_REGISTRYINDEX); // stack: [tbl_new,"ud",REGISTRY.ud]
63-
lua_settable(luaVM, -3); // stack: [tbl_new]
64-
}
65-
return 1;
66-
}
67-
6851
int CLuaUtilDefs::Dereference ( lua_State* luaVM )
6952
{
7053
int iPointer = 0;

Shared/mods/deathmatch/logic/luadefs/CLuaUtilDefs.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ class CLuaUtilDefs : public CLuaDefs
1818

1919
// Reserved functions
2020
LUA_DECLARE ( DisabledFunction );
21-
LUA_DECLARE ( Debug_getregistry );
2221

2322
// Util functions to make scripting easier for the end user
2423
// Some of these are based on standard mIRC script funcs as a lot of people will be used to them

0 commit comments

Comments
 (0)