etpub-g_lua.c.patch

ETpub g_lua.c patch - Phenomenon, 27.04.2013 14:26

Download (1.27 KB)

View differences:

trunk/src/game/g_lua.c (Arbeitskopie)
1471 1471
 */
1472 1472
qboolean G_LuaInit()
1473 1473
{
1474
	char allowedModules[MAX_CVAR_VALUE_STRING];
1474 1475
	int i, num_vm = 0, len, flen = 0;
1475 1476
	char buff[MAX_CVAR_VALUE_STRING], *crt, *code, *signature;
1476 1477
	fileHandle_t f;
......
1479 1480
	if (!lua_modules.string[0])
1480 1481
		return qtrue;
1481 1482
	
1483
	Q_strncpyz(allowedModules, Q_strupr(lua_allowedModules.string), sizeof(allowedModules));
1484

  
1482 1485
	Q_strncpyz(buff, lua_modules.string, sizeof(buff));
1483 1486
	len = strlen(buff);
1484 1487
	crt = buff;
1485 1488
	
1486 1489
	for (i=0; i<LUA_NUM_VM; i++)
1487 1490
		lVM[i] = NULL;
1488
	
1491

  
1489 1492
	for (i=0; i<=len; i++)
1490 1493
		if (buff[i] == ' ' || buff[i] == '\0' || buff[i] == ',' || buff[i] == ';') {
1491 1494
			buff[i] = '\0';
......
1506 1509
				trap_FS_FCloseFile(f);
1507 1510
				signature = G_SHA1(code);
1508 1511

  
1509
				if ( Q_stricmp(lua_allowedModules.string, "") &&
1510
					 !strstr(lua_allowedModules.string, signature) ) {
1512
				if ( Q_stricmp(lua_allowedModules.string, "") && !strstr(allowedModules, signature) ) {
1511 1513
					// don't load disallowed lua modules into vm
1512 1514
					free(code);
1513 1515
					G_Lua_Printf("%s API: Lua module [%s] [%s] disallowed by ACL\n", LUA_VERSION, crt, signature);