[iortcw] 44/95: All: Merge some file writing extension checks
Simon McVittie
smcv at debian.org
Fri Sep 8 10:42:02 UTC 2017
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to tag 1.51
in repository iortcw.
commit 11a83410153756ae350a82ed41b08d128ff7f998
Author: MAN-AT-ARMS <M4N4T4RMS at gmail.com>
Date: Tue Mar 14 03:26:09 2017 -0400
All: Merge some file writing extension checks
---
MP/code/client/cl_console.c | 6 ++++++
MP/code/qcommon/common.c | 6 ++++++
SP/code/client/cl_console.c | 6 ++++++
SP/code/qcommon/common.c | 6 ++++++
4 files changed, 24 insertions(+)
diff --git a/MP/code/client/cl_console.c b/MP/code/client/cl_console.c
index 2df9ad2..dad42d9 100644
--- a/MP/code/client/cl_console.c
+++ b/MP/code/client/cl_console.c
@@ -227,6 +227,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 ) {
Com_Printf ("ERROR: couldn't open %s.\n", filename);
diff --git a/MP/code/qcommon/common.c b/MP/code/qcommon/common.c
index f0ab138..13b36fd 100644
--- a/MP/code/qcommon/common.c
+++ b/MP/code/qcommon/common.c
@@ -3058,6 +3058,12 @@ 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 );
diff --git a/SP/code/client/cl_console.c b/SP/code/client/cl_console.c
index 081fe5a..e7797ea 100644
--- a/SP/code/client/cl_console.c
+++ b/SP/code/client/cl_console.c
@@ -219,6 +219,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 ) {
Com_Printf ("ERROR: couldn't open %s.\n", filename);
diff --git a/SP/code/qcommon/common.c b/SP/code/qcommon/common.c
index 9dd7144..402941f 100644
--- a/SP/code/qcommon/common.c
+++ b/SP/code/qcommon/common.c
@@ -2601,6 +2601,12 @@ 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/iortcw.git
More information about the Pkg-games-commits
mailing list