From b5acc31a4da72cc3a4a6d88facb15b6214d745c6 Mon Sep 17 00:00:00 2001 From: Zachary Slater Date: Thu, 14 Jun 2012 18:28:58 +0000 Subject: [PATCH] CVE-2012-3345 --- code/qcommon/qcommon.h | 1 - code/sys/sys_main.c | 2 +- code/sys/sys_osx.m | 22 ---------------------- code/sys/sys_unix.c | 17 ----------------- code/sys/sys_win32.c | 18 ------------------ 5 files changed, 1 insertion(+), 59 deletions(-) diff --git a/code/qcommon/qcommon.h b/code/qcommon/qcommon.h index 8d36231e..389c4f15 100644 --- a/code/qcommon/qcommon.h +++ b/code/qcommon/qcommon.h @@ -1120,7 +1120,6 @@ char *Sys_DefaultAppPath(void); void Sys_SetDefaultHomePath(const char *path); char *Sys_DefaultHomePath(void); -const char *Sys_TempPath(void); const char *Sys_Dirname( char *path ); const char *Sys_Basename( char *path ); char *Sys_ConsoleInput(void); diff --git a/code/sys/sys_main.c b/code/sys/sys_main.c index ed00b65d..dae8e8f6 100644 --- a/code/sys/sys_main.c +++ b/code/sys/sys_main.c @@ -140,7 +140,7 @@ Sys_PIDFileName */ static char *Sys_PIDFileName( void ) { - return va( "%s/%s", Sys_TempPath( ), PID_FILENAME ); + return va( "%s/%s", Sys_DefaultHomePath( ), PID_FILENAME ); } /* diff --git a/code/sys/sys_osx.m b/code/sys/sys_osx.m index a26d8a28..30bf9322 100644 --- a/code/sys/sys_osx.m +++ b/code/sys/sys_osx.m @@ -34,28 +34,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #import #import -/* -================ -Sys_TempPath -================ -*/ -const char *Sys_TempPath( void ) -{ - static UInt8 posixPath[ MAX_OSPATH ]; - FSRef ref; - if( FSFindFolder( kOnAppropriateDisk, - kTemporaryFolderType, kCreateFolder, &ref ) == noErr ) - { - if( FSRefMakePath( &ref, posixPath, - sizeof( posixPath ) - 1 ) == noErr ) - { - return (const char *)posixPath; - } - } - - return "/tmp"; -} - /* ============== Sys_Dialog diff --git a/code/sys/sys_unix.c b/code/sys/sys_unix.c index e88465d8..a60b0863 100644 --- a/code/sys/sys_unix.c +++ b/code/sys/sys_unix.c @@ -78,23 +78,6 @@ char *Sys_DefaultHomePath(void) return homePath; } -#ifndef MACOS_X -/* -================ -Sys_TempPath -================ -*/ -const char *Sys_TempPath( void ) -{ - const char *TMPDIR = getenv( "TMPDIR" ); - - if( TMPDIR == NULL || TMPDIR[ 0 ] == '\0' ) - return "/tmp"; - else - return TMPDIR; -} -#endif - /* ================ Sys_Milliseconds diff --git a/code/sys/sys_win32.c b/code/sys/sys_win32.c index 241fc927..58fd9aba 100644 --- a/code/sys/sys_win32.c +++ b/code/sys/sys_win32.c @@ -127,24 +127,6 @@ char *Sys_DefaultHomePath( void ) return homePath; } -/* -================ -Sys_TempPath -================ -*/ -const char *Sys_TempPath( void ) -{ - static TCHAR path[ MAX_PATH ]; - DWORD length; - - length = GetTempPath( sizeof( path ), path ); - - if( length > sizeof( path ) || length == 0 ) - return Sys_DefaultHomePath( ); - else - return path; -} - /* ================ Sys_Milliseconds