File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
Server/mods/deathmatch/logic/lua Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -172,6 +172,23 @@ void CLuaMain::InitVM(void)
172
172
luaopen_table (m_luaVM);
173
173
luaopen_debug (m_luaVM);
174
174
luaopen_utf8 (m_luaVM);
175
+ luaopen_os (m_luaVM);
176
+
177
+ // Disable dangerous Lua Os library functions
178
+ lua_getglobal (m_luaVM, " os" );
179
+ lua_pushnil (m_luaVM);
180
+ lua_setfield (m_luaVM, -2 , " execute" );
181
+ lua_pushnil (m_luaVM);
182
+ lua_setfield (m_luaVM, -2 , " rename" );
183
+ lua_pushnil (m_luaVM);
184
+ lua_setfield (m_luaVM, -2 , " remove" );
185
+ lua_pushnil (m_luaVM);
186
+ lua_setfield (m_luaVM, -2 , " exit" );
187
+ lua_pushnil (m_luaVM);
188
+ lua_setfield (m_luaVM, -2 , " getenv" );
189
+ lua_pushnil (m_luaVM);
190
+ lua_setfield (m_luaVM, -2 , " tmpname" );
191
+ lua_pop (m_luaVM, 1 );
175
192
176
193
// Initialize security restrictions. Very important to prevent lua trojans and viruses!
177
194
InitSecurity ();
You can’t perform that action at this time.
0 commit comments