Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F153036081
D10171.id26748.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
24 KB
Referenced Files
None
Subscribers
None
D10171.id26748.diff
View Options
Index: games/ioquake3/Makefile
===================================================================
--- games/ioquake3/Makefile
+++ games/ioquake3/Makefile
@@ -3,7 +3,7 @@
PORTNAME?= ioquake3
DISTVERSION?= 1.36
-PORTREVISION?= 15
+PORTREVISION?= 16
CATEGORIES= games
MASTER_SITES?= http://ioquake3.org/files/${DISTVERSION}/
# Using zip this way enables slaves to override it.
@@ -29,20 +29,21 @@
# Client options
.if ${IOQ3:MCLIENT}
-OPTIONS_DEFINE= SERVER CURL OPENAL MUMBLE VORBIS DEBUG
+OPTIONS_DEFINE= SERVER CURL OPENAL MUMBLE VORBIS
OPTIONS_DEFAULT= SERVER CURL OPENAL MUMBLE VORBIS
SERVER_DESC= Install dedicated server
MUMBLE_DESC= Enable Mumble support (no dependencies)
USE_GL+= gl
.endif
IOQ3_OPTIONS= ${IOQ3:MTOOLS} ${IOQ3:MDLRENDERER} ${IOQ3:MGAMELIBS} \
- ${IOQ3:MOPUS}
-OPTIONS_DEFINE+= ${IOQ3_OPTIONS} DOCS
+ ${IOQ3:MGAMELIBS:S/LIBS$$/QVMS/} ${IOQ3:MOPUS}
+OPTIONS_DEFINE+= ${IOQ3_OPTIONS} DEBUG DOCS
OPTIONS_DEFAULT+= ${IOQ3_OPTIONS}
TOOLS_DESC= Enable modding tools
DLRENDERER_DESC= Build dynamically loaded renderer
GAMELIBS_DESC= Build game libraries
+GAMEQVMS_DESC= Build game VMs
MAKE_ARGS+= DEFAULT_BASEDIR="${Q3DIR}" \
DEFAULT_LIBDIR="${PREFIX}/${LIBDIR}" \
@@ -107,10 +108,6 @@
MUMBLE_MAKE_ARGS_OFF= USE_MUMBLE=0
GAMELIBS_MAKE_ARGS= BUILD_GAME_SO=1
GAMELIBS_MAKE_ARGS_OFF= BUILD_GAME_SO=0
-# Note that SMP is only supported on OS-X, hence the option has been removed.
-SMP_VARS= Q3BIN+=${Q3CLIENT}-smp
-SMP_MAKE_ARGS= BUILD_CLIENT_SMP=1
-SMP_MAKE_ARGS_OFF= BUILD_CLIENT_SMP=0
DLRENDERER_MAKE_ARGS= USE_RENDERER_DLOPEN=1
DLRENDERER_MAKE_ARGS_OFF= USE_RENDERER_DLOPEN=0
@@ -147,6 +144,12 @@
MAKE_ARGS+= USE_INTERNAL_OGG=0
.endif
+.if ${PORT_OPTIONS:MTOOLS} || ${PORT_OPTIONS:MGAMEQVMS}
+MAKE_ARGS+= BUILD_GAME_QVM=1
+.else
+MAKE_ARGS+= BUILD_GAME_QVM=0
+.endif
+
# Generate a set of install instruction tuples: <cmd>;<src>;<dst>
.for bin in ${Q3BIN}
IOQ3_INST+= PROGRAM;${bin}.${IOQ3ARCH};bin/${bin}${BINSUFFIX}
@@ -173,6 +176,15 @@
. endfor
. endfor
.endif
+.if ${PORT_OPTIONS:MGAMEQVMS}
+. for dir in ${Q3BASE}
+PLIST_DIRS+= ${LIBDIR}/${dir}
+PLIST_DIRS+= ${LIBDIR}/${dir}/vm
+. for lib in ${Q3GAMELIBS}
+IOQ3_INST+= DATA;${dir}/vm/${lib}.qvm;${LIBDIR}/${dir}/vm/${lib}.qvm
+. endfor
+. endfor
+.endif
.if ${PORT_OPTIONS:MDLRENDERER} || ${PORT_OPTIONS:MGAMELIBS}
PLIST_DIRS+= ${LIBDIR}
.endif
Index: games/ioquake3/files/patch-Makefile
===================================================================
--- games/ioquake3/files/patch-Makefile
+++ games/ioquake3/files/patch-Makefile
@@ -58,7 +58,7 @@
+ endif
+
+ # flags
-+ BASE_CFLAGS = $(shell env MACHINE_ARCH=$(ARCH) make -f /dev/null -VCFLAGS) \
++ BASE_CFLAGS = \
+ -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
+ -DHOMEPATH=\\\"$(HOMEPATH)\\\" \
+ -DDEFAULT_LIBDIR=\\\"$(DEFAULT_LIBDIR)\\\" \
@@ -67,7 +67,7 @@
+ HAVE_VM_COMPILED = true
- DEBUG_CFLAGS=$(BASE_CFLAGS) -g
-+ OPTIMIZEVM = -O3 -funroll-loops -fomit-frame-pointer
++ OPTIMIZEVM =
+ OPTIMIZE = $(OPTIMIZEVM) -ffast-math
SHLIBEXT=so
Index: games/ioquake3/files/patch-code-client-snd_openal.c
===================================================================
--- games/ioquake3/files/patch-code-client-snd_openal.c
+++ games/ioquake3/files/patch-code-client-snd_openal.c
@@ -9,3 +9,16 @@
#endif
/*
+@@ -1992,6 +1992,12 @@ qboolean S_AL_Init( soundInterface_t *si
+
+ s_alDriver = Cvar_Get( "s_alDriver", ALDRIVER_DEFAULT, CVAR_ARCHIVE );
+
++ if ( COM_CompareExtension( s_alDriver->string, ".pk3" ) )
++ {
++ Com_Printf( S_COLOR_RED "Rejecting s_alDriver named \"%s\"\n", s_alDriver->string );
++ return qfalse;
++ }
++
+ // Load QAL
+ if( !QAL_Init( s_alDriver->string ) )
+ {
Index: games/ioquake3/files/patch-code-qcommon-files.c
===================================================================
--- games/ioquake3/files/patch-code-qcommon-files.c
+++ games/ioquake3/files/patch-code-qcommon-files.c
@@ -1,6 +1,16 @@
--- code/qcommon/files.c.orig 2009-02-26 13:02:59 UTC
+++ code/qcommon/files.c
-@@ -241,6 +241,7 @@ static cvar_t *fs_apppath;
+@@ -187,6 +187,9 @@ static const unsigned pak_checksums[] =
+ 977125798u
+ };
+
++int dangerousPaksFound;
++char dangerousPakNames[MAX_ZPATH][MAX_SEARCH_PATHS];
++
+ // if this is defined, the executable positively won't work with any paks other
+ // than the demo pak, even if productid is present. This is only used for our
+ // last demo release to prevent the mac and linux users from using the demo
+@@ -241,6 +244,7 @@ static cvar_t *fs_apppath;
#endif
static cvar_t *fs_basepath;
@@ -8,7 +18,250 @@
static cvar_t *fs_basegame;
static cvar_t *fs_gamedirvar;
static searchpath_t *fs_searchpaths;
-@@ -2761,6 +2762,7 @@ static void FS_Startup( const char *game
+@@ -499,25 +503,27 @@ static qboolean FS_CreatePath (char *OSP
+ return qfalse;
+ }
+
++
+ /*
+ =================
+-FS_CheckFilenameIsNotExecutable
++FS_CheckFilenameIsMutable
+
+-ERR_FATAL if trying to maniuplate a file with the platform library extension
++ERR_FATAL if trying to maniuplate a file with the platform library, QVM, or pk3 extension
+ =================
+ */
+-static void FS_CheckFilenameIsNotExecutable( const char *filename,
++static void FS_CheckFilenameIsMutable( const char *filename,
+ const char *function )
+ {
+- // Check if the filename ends with the library extension
+- if( !Q_stricmp( COM_GetExtension( filename ), DLL_EXT ) )
++ // Check if the filename ends with the library, QVM, or pk3 extension
++ if( COM_CompareExtension( filename, DLL_EXT )
++ || COM_CompareExtension( filename, ".qvm" )
++ || COM_CompareExtension( filename, ".pk3" ) )
+ {
+ Com_Error( ERR_FATAL, "%s: Not allowed to manipulate '%s' due "
+- "to %s extension\n", function, filename, DLL_EXT );
++ "to %s extension", function, filename, COM_GetExtension( filename ) );
+ }
+ }
+
+-
+ /*
+ =================
+ FS_CopyFile
+@@ -532,7 +538,7 @@ static void FS_CopyFile( char *fromOSPat
+
+ Com_Printf( "copy %s to %s\n", fromOSPath, toOSPath );
+
+- FS_CheckFilenameIsNotExecutable( toOSPath, __func__ );
++ FS_CheckFilenameIsMutable( toOSPath, __func__ );
+
+ if (strstr(fromOSPath, "journal.dat") || strstr(fromOSPath, "journaldata.dat")) {
+ Com_Printf( "Ignoring journal files\n");
+@@ -575,7 +581,7 @@ FS_Remove
+ ===========
+ */
+ void FS_Remove( const char *osPath ) {
+- FS_CheckFilenameIsNotExecutable( osPath, __func__ );
++ FS_CheckFilenameIsMutable( osPath, __func__ );
+
+ remove( osPath );
+ }
+@@ -587,7 +593,7 @@ FS_HomeRemove
+ ===========
+ */
+ void FS_HomeRemove( const char *homePath ) {
+- FS_CheckFilenameIsNotExecutable( homePath, __func__ );
++ FS_CheckFilenameIsMutable( homePath, __func__ );
+
+ remove( FS_BuildOSPath( fs_homepath->string,
+ fs_gamedir, homePath ) );
+@@ -666,7 +672,7 @@ fileHandle_t FS_SV_FOpenFileWrite( const
+ Com_Printf( "FS_SV_FOpenFileWrite: %s\n", ospath );
+ }
+
+- FS_CheckFilenameIsNotExecutable( ospath, __func__ );
++ FS_CheckFilenameIsMutable( ospath, __func__ );
+
+ if( FS_CreatePath( ospath ) ) {
+ return 0;
+@@ -758,7 +764,7 @@ FS_SV_Rename
+
+ ===========
+ */
+-void FS_SV_Rename( const char *from, const char *to ) {
++void FS_SV_Rename( const char *from, const char *to, qboolean safe ) {
+ char *from_ospath, *to_ospath;
+
+ if ( !fs_searchpaths ) {
+@@ -777,7 +783,9 @@ void FS_SV_Rename( const char *from, con
+ Com_Printf( "FS_SV_Rename: %s --> %s\n", from_ospath, to_ospath );
+ }
+
+- FS_CheckFilenameIsNotExecutable( to_ospath, __func__ );
++ if ( safe ) {
++ FS_CheckFilenameIsMutable( to_ospath, __func__ );
++ }
+
+ if (rename( from_ospath, to_ospath )) {
+ // Failed, try copying it and deleting the original
+@@ -811,7 +819,7 @@ void FS_Rename( const char *from, const
+ Com_Printf( "FS_Rename: %s --> %s\n", from_ospath, to_ospath );
+ }
+
+- FS_CheckFilenameIsNotExecutable( to_ospath, __func__ );
++ FS_CheckFilenameIsMutable( to_ospath, __func__ );
+
+ if (rename( from_ospath, to_ospath )) {
+ // Failed, try copying it and deleting the original
+@@ -874,7 +882,7 @@ fileHandle_t FS_FOpenFileWrite( const ch
+ Com_Printf( "FS_FOpenFileWrite: %s\n", ospath );
+ }
+
+- FS_CheckFilenameIsNotExecutable( ospath, __func__ );
++ FS_CheckFilenameIsMutable( ospath, __func__ );
+
+ if( FS_CreatePath( ospath ) ) {
+ return 0;
+@@ -922,7 +930,7 @@ fileHandle_t FS_FOpenFileAppend( const c
+ Com_Printf( "FS_FOpenFileAppend: %s\n", ospath );
+ }
+
+- FS_CheckFilenameIsNotExecutable( ospath, __func__ );
++ FS_CheckFilenameIsMutable( ospath, __func__ );
+
+ if( FS_CreatePath( ospath ) ) {
+ return 0;
+@@ -995,6 +1003,7 @@ int FS_FOpenFileRead( const char *filena
+ FILE *temp;
+ int l;
+ char demoExt[16];
++ qboolean isLocalConfig, isQVM;
+
+ hash = 0;
+
+@@ -1002,11 +1011,22 @@ int FS_FOpenFileRead( const char *filena
+ Com_Error( ERR_FATAL, "Filesystem call made without initialization\n" );
+ }
+
++ isLocalConfig = !Q_stricmp(filename, "autoexec.cfg") || !Q_stricmp(filename, "q3config.cfg");
++ isQVM = COM_CompareExtension(filename, ".qvm");
++
+ if ( file == NULL ) {
+ // just wants to see if file is there
+ for ( search = fs_searchpaths ; search ; search = search->next ) {
+ //
+ if ( search->pack ) {
++ // autoexec.cfg and q3config.cfg can only be loaded outside of pk3 files.
++ if (isLocalConfig)
++ continue;
++
++ // QVMs can't be loaded from pk3 in the "download" directory
++ if (isQVM && !Q_stricmp(search->pack->pakGamename, "download"))
++ continue;
++
+ hash = FS_HashFileName(filename, search->pack->hashSize);
+ }
+ // is the element a pak file?
+@@ -1072,6 +1092,14 @@ int FS_FOpenFileRead( const char *filena
+ for ( search = fs_searchpaths ; search ; search = search->next ) {
+ //
+ if ( search->pack ) {
++ // autoexec.cfg and q3config.cfg can only be loaded outside of pk3 files.
++ if (isLocalConfig)
++ continue;
++
++ // QVMs can't be loaded from pk3 in the "download" directory
++ if (isQVM && !Q_stricmp(search->pack->pakGamename, "download"))
++ continue;
++
+ hash = FS_HashFileName(filename, search->pack->hashSize);
+ }
+ // is the element a pak file?
+@@ -1678,7 +1706,7 @@ Creates a new pak_t in the search chain
+ of a zip file.
+ =================
+ */
+-static pack_t *FS_LoadZipFile( char *zipfile, const char *basename )
++static pack_t *FS_LoadZipFile( char *zipfile, const char *basename, const char *gamename )
+ {
+ fileInPack_t *buildBuffer;
+ pack_t *pack;
+@@ -1687,11 +1715,12 @@ static pack_t *FS_LoadZipFile( char *zip
+ unz_global_info gi;
+ char filename_inzip[MAX_ZPATH];
+ unz_file_info file_info;
+- int i, len;
++ int i, j, len;
+ long hash;
+ int fs_numHeaderLongs;
+ int *fs_headerLongs;
+ char *namePtr;
++ qboolean alreadydangerous = qfalse;
+
+ fs_numHeaderLongs = 0;
+
+@@ -1737,6 +1766,7 @@ static pack_t *FS_LoadZipFile( char *zip
+
+ Q_strncpyz( pack->pakFilename, zipfile, sizeof( pack->pakFilename ) );
+ Q_strncpyz( pack->pakBasename, basename, sizeof( pack->pakBasename ) );
++ Q_strncpyz( pack->pakGamename, gamename, sizeof( pack->pakGamename ) );
+
+ // strip .pk3 if needed
+ if ( strlen( pack->pakBasename ) > 4 && !Q_stricmp( pack->pakBasename + strlen( pack->pakBasename ) - 4, ".pk3" ) ) {
+@@ -1753,6 +1783,30 @@ static pack_t *FS_LoadZipFile( char *zip
+ if (err != UNZ_OK) {
+ break;
+ }
++
++ if (!Q_stricmp(pack->pakGamename, "download") && (
++ COM_CompareExtension(filename_inzip, ".qvm") ||
++ !Q_stricmp(filename_inzip, "autoexec.cfg") ||
++ !Q_stricmp(filename_inzip, "q3config.cfg")))
++ {
++
++ for (j = 0; j < dangerousPaksFound; j++) {
++ if (!strcmp(dangerousPakNames[j], pack->pakBasename)) {
++ alreadydangerous = qtrue;
++ break;
++ }
++ }
++
++ if (!alreadydangerous) {
++ Q_strncpyz(dangerousPakNames[dangerousPaksFound], pack->pakBasename, MAX_ZPATH);
++ dangerousPaksFound++;
++ }
++
++ Com_Printf(S_COLOR_RED "Dangerous file %s found in %s\n",
++ filename_inzip,
++ pack->pakFilename);
++ }
++
+ if (file_info.uncompressed_size > 0) {
+ fs_headerLongs[fs_numHeaderLongs++] = LittleLong(file_info.crc);
+ }
+@@ -2480,10 +2534,8 @@ void FS_AddGameDirectory( const char *pa
+
+ for ( i = 0 ; i < numfiles ; i++ ) {
+ pakfile = FS_BuildOSPath( path, dir, pakfiles[i] );
+- if ( ( pak = FS_LoadZipFile( pakfile, pakfiles[i] ) ) == 0 )
++ if ( ( pak = FS_LoadZipFile( pakfile, pakfiles[i], dir ) ) == 0 )
+ continue;
+- // store the game name for downloading
+- strcpy(pak->pakGamename, dir);
+
+ search = Z_Malloc (sizeof(searchpath_t));
+ search->pack = pak;
+@@ -2758,9 +2810,12 @@ static void FS_Startup( const char *game
+
+ Com_Printf( "----- FS_Startup -----\n" );
+
++ dangerousPaksFound = 0;
++
fs_debug = Cvar_Get( "fs_debug", "0", 0 );
fs_basepath = Cvar_Get ("fs_basepath", Sys_DefaultInstallPath(), CVAR_INIT );
fs_basegame = Cvar_Get ("fs_basegame", "", CVAR_INIT );
Index: games/ioquake3/files/patch-code-qcommon-qcommon.h
===================================================================
--- games/ioquake3/files/patch-code-qcommon-qcommon.h
+++ games/ioquake3/files/patch-code-qcommon-qcommon.h
@@ -1,6 +1,28 @@
--- code/qcommon/qcommon.h.orig 2009-01-17 23:09:58 UTC
+++ code/qcommon/qcommon.h
-@@ -1069,6 +1069,9 @@ char *Sys_DefaultInstallPath(void);
+@@ -556,6 +556,12 @@ issues.
+ ==============================================================
+ */
+
++#define MAX_ZPATH 256
++#define MAX_SEARCH_PATHS 4096
++
++extern int dangerousPaksFound;
++extern char dangerousPakNames[MAX_ZPATH][MAX_SEARCH_PATHS];
++
+ // referenced flags
+ // these are in loop specific order so don't change the order
+ #define FS_GENERAL_REF 0x01
+@@ -606,7 +612,7 @@ fileHandle_t FS_FOpenFileAppend( const c
+
+ fileHandle_t FS_SV_FOpenFileWrite( const char *filename );
+ int FS_SV_FOpenFileRead( const char *filename, fileHandle_t *fp );
+-void FS_SV_Rename( const char *from, const char *to );
++void FS_SV_Rename( const char *from, const char *to, qboolean safe );
+ int FS_FOpenFileRead( const char *qpath, fileHandle_t *file, qboolean uniqueFILE );
+ // if uniqueFILE is true, then a new FILE will be fopened even if the file
+ // is found in an already open pak file. If uniqueFILE is false, you must call
+@@ -1069,6 +1075,9 @@ char *Sys_DefaultInstallPath(void);
char *Sys_DefaultAppPath(void);
#endif
Index: games/ioquake3/files/patch-code-sys-sys_main.c
===================================================================
--- games/ioquake3/files/patch-code-sys-sys_main.c
+++ games/ioquake3/files/patch-code-sys-sys_main.c
@@ -39,7 +39,21 @@
Sys_DefaultAppPath
=================
*/
-@@ -384,6 +409,7 @@ Used to load a development dll instead o
+@@ -358,6 +383,13 @@ static void* Sys_TryLibraryLoad(const ch
+ void* libHandle;
+ char* fn;
+
++ // Don't load any DLLs that end with the pk3 extension
++ if (COM_CompareExtension(fname, ".pk3"))
++ {
++ Com_Printf(S_COLOR_RED "Rejecting DLL named \"%s\"\n", fname);
++ return NULL;
++ }
++
+ *fqpath = 0;
+
+ fn = FS_BuildOSPath( base, gamedir, fname );
+@@ -384,6 +416,7 @@ Used to load a development dll instead o
#1 look down current path
#2 look in fs_homepath
#3 look in fs_basepath
@@ -47,7 +61,7 @@
=================
*/
void *Sys_LoadDll( const char *name, char *fqpath ,
-@@ -394,6 +420,7 @@ void *Sys_LoadDll( const char *name, cha
+@@ -394,6 +427,7 @@ void *Sys_LoadDll( const char *name, cha
void (*dllEntry)( intptr_t (*syscallptr)(intptr_t, ...) );
char fname[MAX_OSPATH];
char *basepath;
@@ -55,7 +69,7 @@
char *homepath;
char *pwdpath;
char *gamedir;
-@@ -405,6 +432,7 @@ void *Sys_LoadDll( const char *name, cha
+@@ -405,6 +439,7 @@ void *Sys_LoadDll( const char *name, cha
// TODO: use fs_searchpaths from files.c
pwdpath = Sys_Cwd();
basepath = Cvar_VariableString( "fs_basepath" );
@@ -63,7 +77,7 @@
homepath = Cvar_VariableString( "fs_homepath" );
gamedir = Cvar_VariableString( "fs_game" );
-@@ -413,6 +441,9 @@ void *Sys_LoadDll( const char *name, cha
+@@ -413,6 +448,9 @@ void *Sys_LoadDll( const char *name, cha
if(!libHandle && homepath)
libHandle = Sys_TryLibraryLoad(homepath, gamedir, fname, fqpath);
@@ -73,7 +87,7 @@
if(!libHandle && basepath)
libHandle = Sys_TryLibraryLoad(basepath, gamedir, fname, fqpath);
-@@ -469,6 +500,10 @@ void Sys_ParseArgs( int argc, char **arg
+@@ -469,6 +507,10 @@ void Sys_ParseArgs( int argc, char **arg
# endif
#endif
@@ -84,7 +98,7 @@
/*
=================
Sys_SigHandler
-@@ -540,6 +575,7 @@ int main( int argc, char **argv )
+@@ -540,6 +582,7 @@ int main( int argc, char **argv )
Sys_ParseArgs( argc, argv );
Sys_SetBinaryPath( Sys_Dirname( argv[ 0 ] ) );
Sys_SetDefaultInstallPath( DEFAULT_BASEDIR );
Index: games/ioquake3/files/patch-code_botlib_be__aas__route.c
===================================================================
--- /dev/null
+++ games/ioquake3/files/patch-code_botlib_be__aas__route.c
@@ -0,0 +1,38 @@
+--- code/botlib/be_aas_route.c.orig 2005-12-05 17:32:54 UTC
++++ code/botlib/be_aas_route.c
+@@ -106,7 +106,7 @@ void AAS_RoutingInfo(void)
+ // Returns: -
+ // Changes Globals: -
+ //===========================================================================
+-ID_INLINE int AAS_ClusterAreaNum(int cluster, int areanum)
++static ID_INLINE int AAS_ClusterAreaNum(int cluster, int areanum)
+ {
+ int side, areacluster;
+
+@@ -166,7 +166,7 @@ void AAS_InitTravelFlagFromType(void)
+ // Returns: -
+ // Changes Globals: -
+ //===========================================================================
+-ID_INLINE int AAS_TravelFlagForType_inline(int traveltype)
++static ID_INLINE int AAS_TravelFlagForType_inline(int traveltype)
+ {
+ int tfl;
+
+@@ -339,7 +339,7 @@ int AAS_EnableRoutingArea(int areanum, i
+ // Returns: -
+ // Changes Globals: -
+ //===========================================================================
+-ID_INLINE float AAS_RoutingTime(void)
++static ID_INLINE float AAS_RoutingTime(void)
+ {
+ return AAS_Time();
+ } //end of the function AAS_RoutingTime
+@@ -379,7 +379,7 @@ int AAS_GetAreaContentsTravelFlags(int a
+ // Returns: -
+ // Changes Globals: -
+ //===========================================================================
+-ID_INLINE int AAS_AreaContentsTravelFlags_inline(int areanum)
++static ID_INLINE int AAS_AreaContentsTravelFlags_inline(int areanum)
+ {
+ return aasworld.areacontentstravelflags[areanum];
+ } //end of the function AAS_AreaContentsTravelFlags
Index: games/ioquake3/files/patch-code_client_cl__console.c
===================================================================
--- /dev/null
+++ games/ioquake3/files/patch-code_client_cl__console.c
@@ -0,0 +1,58 @@
+--- code/client/cl_console.c.orig 2008-11-02 17:39:25 UTC
++++ code/client/cl_console.c
+@@ -172,7 +172,9 @@ void Con_Dump_f (void)
+ int l, x, i;
+ short *line;
+ fileHandle_t f;
+- char buffer[1024];
++ int bufferlen;
++ char *buffer;
++ char filename[MAX_QPATH];
+
+ if (Cmd_Argc() != 2)
+ {
+@@ -180,15 +182,24 @@ void Con_Dump_f (void)
+ return;
+ }
+
+- Com_Printf ("Dumped console text to %s.\n", Cmd_Argv(1) );
++ Q_strncpyz( filename, Cmd_Argv( 1 ), sizeof( filename ) );
++ COM_DefaultExtension( filename, sizeof( filename ), ".txt" );
+
+- f = FS_FOpenFileWrite( Cmd_Argv( 1 ) );
++ if (!COM_CompareExtension(filename, ".txt"))
++ {
++ Com_Printf("Con_Dump_f: Only the \".txt\" extension is supported by this command!\n");
++ return;
++ }
++
++ f = FS_FOpenFileWrite( filename );
+ if (!f)
+ {
+- Com_Printf ("ERROR: couldn't open.\n");
++ Com_Printf ("ERROR: couldn't open %s.\n", filename);
+ return;
+ }
+
++ Com_Printf ("Dumped console text to %s.\n", filename );
++
+ // skip empty lines
+ for (l = con.current - con.totallines + 1 ; l <= con.current ; l++)
+ {
+@@ -214,10 +225,15 @@ void Con_Dump_f (void)
+ else
+ break;
+ }
+- strcat( buffer, "\n" );
++#ifdef _WIN32
++ Q_strcat(buffer, bufferlen, "\r\n");
++#else
++ Q_strcat(buffer, bufferlen, "\n");
++#endif
+ FS_Write(buffer, strlen(buffer), f);
+ }
+
++ Hunk_FreeTempMemory( buffer );
+ FS_FCloseFile( f );
+ }
+
Index: games/ioquake3/files/patch-code_client_cl__curl.c
===================================================================
--- /dev/null
+++ games/ioquake3/files/patch-code_client_cl__curl.c
@@ -0,0 +1,25 @@
+--- code/client/cl_curl.c.orig 2008-10-24 07:08:52 UTC
++++ code/client/cl_curl.c
+@@ -94,6 +94,13 @@ qboolean CL_cURL_Init()
+
+
+ Com_Printf("Loading \"%s\"...", cl_cURLLib->string);
++
++ if ( COM_CompareExtension( cl_cURLLib->string, ".pk3" ) )
++ {
++ Com_Printf( S_COLOR_RED "Rejecting cl_cURLLib named \"%s\"\n", cl_cURLLib->string );
++ return qfalse;
++ }
++
+ if( (cURLLib = Sys_LoadLibrary(cl_cURLLib->string)) == 0 )
+ {
+ #ifdef _WIN32
+@@ -320,7 +327,7 @@ void CL_cURL_PerformDownload(void)
+ }
+ FS_FCloseFile(clc.download);
+ if(msg->msg == CURLMSG_DONE && msg->data.result == CURLE_OK) {
+- FS_SV_Rename(clc.downloadTempName, clc.downloadName);
++ FS_SV_Rename(clc.downloadTempName, clc.downloadName, qfalse);
+ clc.downloadRestart = qtrue;
+ }
+ else {
Index: games/ioquake3/files/patch-code_client_cl__parse.c
===================================================================
--- /dev/null
+++ games/ioquake3/files/patch-code_client_cl__parse.c
@@ -0,0 +1,38 @@
+--- code/client/cl_parse.c.orig 2017-03-28 11:59:17 UTC
++++ code/client/cl_parse.c
+@@ -527,6 +527,26 @@ void CL_ParseGamestate( msg_t *msg ) {
+ // reinitialize the filesystem if the game directory has changed
+ FS_ConditionalRestart( clc.checksumFeed );
+
++ if (dangerousPaksFound) {
++ char PakList[MAX_STRING_CHARS];
++ for (i = 0; i < dangerousPaksFound; i++) {
++ Q_strcat(PakList, sizeof(PakList), va("%s.pk3, ", dangerousPakNames[i]));
++ }
++
++ PakList[strlen(PakList) - 2] = 0;
++
++ Cvar_Set("com_errorMessage", va(
++ "^1WARNING! ^7Dangerous file(s) found in downloaded pk3%s:\n\n%s\n\n"
++ "You should go delete %s immediately. %s could lead to malicious code execution.",
++ dangerousPaksFound == 1 ? "" : "s",
++ PakList,
++ dangerousPaksFound == 1 ? "that file" : "those files",
++ dangerousPaksFound == 1 ? "It" : "They"));
++
++ VM_Call(uivm, UI_SET_ACTIVE_MENU, UIMENU_MAIN);
++ return;
++ }
++
+ // This used to call CL_StartHunkUsers, but now we enter the download state before loading the
+ // cgame
+ CL_InitDownloads();
+@@ -617,7 +637,7 @@ void CL_ParseDownload ( msg_t *msg ) {
+ clc.download = 0;
+
+ // rename the file
+- FS_SV_Rename ( clc.downloadTempName, clc.downloadName );
++ FS_SV_Rename ( clc.downloadTempName, clc.downloadName, qfalse );
+ }
+ *clc.downloadTempName = *clc.downloadName = 0;
+ Cvar_Set( "cl_downloadName", "" );
Index: games/ioquake3/files/patch-code_qcommon_common.c
===================================================================
--- /dev/null
+++ games/ioquake3/files/patch-code_qcommon_common.c
@@ -0,0 +1,16 @@
+--- code/qcommon/common.c.orig 2009-03-02 22:26:36 UTC
++++ code/qcommon/common.c
+@@ -2753,6 +2753,13 @@ void Com_WriteConfig_f( void ) {
+
+ Q_strncpyz( filename, Cmd_Argv(1), sizeof( filename ) );
+ COM_DefaultExtension( filename, sizeof( filename ), ".cfg" );
++
++ if (!COM_CompareExtension(filename, ".cfg"))
++ {
++ Com_Printf("Com_WriteConfig_f: Only the \".cfg\" extension is supported by this command!\n");
++ return;
++ }
++
+ Com_Printf( "Writing %s.\n", filename );
+ Com_WriteConfigToFile( filename );
+ }
Index: games/ioquake3/files/patch-code_qcommon_q__shared.h
===================================================================
--- /dev/null
+++ games/ioquake3/files/patch-code_qcommon_q__shared.h
@@ -0,0 +1,10 @@
+--- code/qcommon/q_shared.h.orig 2008-11-03 17:03:54 UTC
++++ code/qcommon/q_shared.h
+@@ -617,6 +617,7 @@ float Com_Clamp( float min, float max, f
+ char *COM_SkipPath( char *pathname );
+ const char *COM_GetExtension( const char *name );
+ void COM_StripExtension(const char *in, char *out, int destsize);
++qboolean COM_CompareExtension(const char *in, const char *ext);
+ void COM_DefaultExtension( char *path, int maxSize, const char *extension );
+
+ void COM_BeginParseSession( const char *name );
Index: games/ioquake3/files/patch-code_qcommon_q__shared.c
===================================================================
--- /dev/null
+++ games/ioquake3/files/patch-code_qcommon_q__shared.c
@@ -0,0 +1,33 @@
+--- code/qcommon/q_shared.c.orig 2008-11-10 23:55:22 UTC
++++ code/qcommon/q_shared.c
+@@ -96,6 +96,30 @@ void COM_StripExtension( const char *in,
+ out[length] = 0;
+ }
+
++/*
++============
++COM_CompareExtension
++
++string compare the end of the strings and return qtrue if strings match
++============
++*/
++qboolean COM_CompareExtension(const char *in, const char *ext)
++{
++ int inlen, extlen;
++
++ inlen = strlen(in);
++ extlen = strlen(ext);
++
++ if(extlen <= inlen)
++ {
++ in += inlen - extlen;
++
++ if(!Q_stricmp(in, ext))
++ return qtrue;
++ }
++
++ return qfalse;
++}
+
+ /*
+ ==================
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Apr 19, 6:42 PM (10 h, 48 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31790104
Default Alt Text
D10171.id26748.diff (24 KB)
Attached To
Mode
D10171: games/ioquake3: Fix CVE-2017-6903
Attached
Detach File
Event Timeline
Log In to Comment