[ioquake3] 08/136: Merge some file writing extension checks from OpenJK.

Simon McVittie smcv at debian.org
Thu Jun 15 09:08:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch debian/master
in repository ioquake3.

commit b173ac05993f634a42be3d3535e1b158de0c3372
Author: SmileTheory <SmileTheory at gmail.com>
Date:   Mon Mar 13 20:44:47 2017 -0700

    Merge some file writing extension checks from OpenJK.
    
    Thanks Ensiform.
    https://github.com/JACoders/OpenJK/commit/05928a57f9e4aae15a3bd0
    https://github.com/JACoders/OpenJK/commit/ef124fd0fc48af164581176
---
 code/client/cl_console.c | 6 ++++++
 code/qcommon/common.c    | 7 +++++++
 2 files changed, 13 insertions(+)

diff --git a/code/client/cl_console.c b/code/client/cl_console.c
index 7d806e9..32ab87e 100644
--- a/code/client/cl_console.c
+++ b/code/client/cl_console.c
@@ -191,6 +191,12 @@ void Con_Dump_f (void)
 	Q_strncpyz( filename, Cmd_Argv( 1 ), sizeof( filename ) );
 	COM_DefaultExtension( filename, sizeof( filename ), ".txt" );
 
+	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)
 	{
diff --git a/code/qcommon/common.c b/code/qcommon/common.c
index db9b435..f3cf121 100644
--- a/code/qcommon/common.c
+++ b/code/qcommon/common.c
@@ -2975,6 +2975,13 @@ void Com_WriteConfig_f( void ) {
 		return;
 	}
 
+
+	if (!COM_CompareExtension(filename, ".cfg"))
+	{
+		Com_Printf("Com_WriteConfig_f: Only the \".cfg\" extension is supported by this command!\n");
+		return;
+	}
+
 	Q_strncpyz( filename, Cmd_Argv(1), sizeof( filename ) );
 	COM_DefaultExtension( filename, sizeof( filename ), ".cfg" );
 	Com_Printf( "Writing %s.\n", filename );

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/ioquake3.git



More information about the Pkg-games-commits mailing list