Skip to content

Commit

Permalink
Remove unnecessary lua_State params from CFFScriptManager::RemoveVars…
Browse files Browse the repository at this point in the history
…FromGlobal/RemoveKeysFromGlobalTable functions
  • Loading branch information
squeek502 committed Dec 2, 2014
1 parent 5f38e78 commit fbeb403
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions dlls/ff/ff_scriptman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,19 +187,19 @@ void CFFScriptManager::MakeEnvironmentSafe()

// dofile, load, loadfile, loadstring
const char* ppszUnsafeGlobalFunctions[] = { "dofile", "load", "loadfile", "loadstring", NULL };
RemoveVarsFromGlobal( L, ppszUnsafeGlobalFunctions );
RemoveVarsFromGlobal( ppszUnsafeGlobalFunctions );

// os.*
const char* ppszUnsafeOSFunctions[] = { "execute", "exit", "getenv", "remove", "rename", "setlocale", "tmpname", NULL };
RemoveKeysFromGlobalTable( L, LUA_OSLIBNAME, ppszUnsafeOSFunctions );
RemoveKeysFromGlobalTable( LUA_OSLIBNAME, ppszUnsafeOSFunctions );

// package.*
const char* ppszUnsafePackageFunctions[] = { "loadlib", NULL };
RemoveKeysFromGlobalTable( L, LUA_LOADLIBNAME, ppszUnsafePackageFunctions );
RemoveKeysFromGlobalTable( LUA_LOADLIBNAME, ppszUnsafePackageFunctions );

// io.* gives access to the filesystem, just remove it totally
const char* ppszUnsafeLibraries[] = { "io", NULL };
RemoveVarsFromGlobal( L, ppszUnsafeLibraries );
RemoveVarsFromGlobal( ppszUnsafeLibraries );

// require can load .dll/.so, need to disable the loaders that search for them
// the third index checks package.cpath and loads .so/.dll files
Expand Down Expand Up @@ -512,7 +512,7 @@ bool CFFScriptManager::GetFunction(luabind::adl::object& tableObject,
return false;
}

void CFFScriptManager::RemoveVarsFromGlobal( lua_State *L, const char** ppszVars )
void CFFScriptManager::RemoveVarsFromGlobal( const char** ppszVars )
{
for( int i=0; ppszVars[i] != NULL; ++i )
{
Expand All @@ -521,7 +521,7 @@ void CFFScriptManager::RemoveVarsFromGlobal( lua_State *L, const char** ppszVars
}
}

void CFFScriptManager::RemoveKeysFromGlobalTable( lua_State *L, const char *pszTableName, const char** ppszKeys )
void CFFScriptManager::RemoveKeysFromGlobalTable( const char *pszTableName, const char** ppszKeys )
{
lua_getglobal(L, pszTableName);
if (lua_type(L, -1) == LUA_TTABLE)
Expand Down
4 changes: 2 additions & 2 deletions dlls/ff/ff_scriptman.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class CFFScriptManager
bool GetFunction(CBaseEntity* pEntity, const char* szFunctionName, luabind::adl::object& outObject);
bool GetFunction(luabind::adl::object& tableObject, const char* szFunctionName, luabind::adl::object& outObject);

void RemoveVarsFromGlobal( lua_State *L, const char **ppszVars );
void RemoveKeysFromGlobalTable( lua_State *L, const char *pszTableName, const char **ppszKeys );
void RemoveVarsFromGlobal( const char **ppszVars );
void RemoveKeysFromGlobalTable( const char *pszTableName, const char **ppszKeys );

bool RunPredicates_LUA( CBaseEntity *pObject, CFFLuaSC *pContext, const char *szFunctionName );

Expand Down

0 comments on commit fbeb403

Please sign in to comment.