Skip to content

Commit 376267d

Browse files
committed
Don't load .pk3s as .dlls, and don't load user config files from .pk3s.
1 parent cd41690 commit 376267d

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

Diff for: code/client/cl_main.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -3200,7 +3200,7 @@ void CL_InitRef( void ) {
32003200
Com_Printf( "----- Initializing Renderer ----\n" );
32013201

32023202
#ifdef USE_RENDERER_DLOPEN
3203-
cl_renderer = Cvar_Get("cl_renderer", "opengl2", CVAR_ARCHIVE | CVAR_LATCH);
3203+
cl_renderer = Cvar_Get("cl_renderer", "opengl2", CVAR_ARCHIVE | CVAR_LATCH | CVAR_PROTECTED);
32043204

32053205
Com_sprintf(dllName, sizeof(dllName), "renderer_%s_" ARCH_STRING DLL_EXT, cl_renderer->string);
32063206

@@ -3551,7 +3551,7 @@ void CL_Init( void ) {
35513551

35523552
cl_allowDownload = Cvar_Get ("cl_allowDownload", "0", CVAR_ARCHIVE);
35533553
#ifdef USE_CURL_DLOPEN
3554-
cl_cURLLib = Cvar_Get("cl_cURLLib", DEFAULT_CURL_LIB, CVAR_ARCHIVE);
3554+
cl_cURLLib = Cvar_Get("cl_cURLLib", DEFAULT_CURL_LIB, CVAR_ARCHIVE | CVAR_PROTECTED);
35553555
#endif
35563556

35573557
cl_conXOffset = Cvar_Get ("cl_conXOffset", "0", 0);

Diff for: code/qcommon/files.c

+6
Original file line numberDiff line numberDiff line change
@@ -1364,12 +1364,18 @@ long FS_FOpenFileRead(const char *filename, fileHandle_t *file, qboolean uniqueF
13641364
{
13651365
searchpath_t *search;
13661366
long len;
1367+
qboolean isLocalConfig;
13671368

13681369
if(!fs_searchpaths)
13691370
Com_Error(ERR_FATAL, "Filesystem call made without initialization");
13701371

1372+
isLocalConfig = !strcmp(filename, "autoexec.cfg") || !strcmp(filename, Q3CONFIG_CFG);
13711373
for(search = fs_searchpaths; search; search = search->next)
13721374
{
1375+
// autoexec.cfg and q3config.cfg can only be loaded outside of pk3 files.
1376+
if (isLocalConfig && search->pack)
1377+
continue;
1378+
13731379
len = FS_FOpenFileReadDir(filename, search, file, uniqueFILE, qfalse);
13741380

13751381
if(file == NULL)

Diff for: code/sys/sys_main.c

+7
Original file line numberDiff line numberDiff line change
@@ -500,6 +500,13 @@ void *Sys_LoadDll(const char *name, qboolean useSystemLib)
500500
{
501501
void *dllhandle;
502502

503+
// Don't load any DLLs that end with the pk3 extension
504+
if (COM_CompareExtension(name, ".pk3"))
505+
{
506+
Com_Printf("Rejecting DLL named \"%s\"", name);
507+
return NULL;
508+
}
509+
503510
if(useSystemLib)
504511
Com_Printf("Trying to load \"%s\"...\n", name);
505512

0 commit comments

Comments
 (0)