Skip to content

Commit b173ac0

Browse files
committed
Merge some file writing extension checks from OpenJK.
Thanks Ensiform. JACoders/OpenJK@05928a57f9e4aae15a3bd0 JACoders/OpenJK@ef124fd0fc48af164581176
1 parent f61fe5f commit b173ac0

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Diff for: code/client/cl_console.c

+6
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@ void Con_Dump_f (void)
191191
Q_strncpyz( filename, Cmd_Argv( 1 ), sizeof( filename ) );
192192
COM_DefaultExtension( filename, sizeof( filename ), ".txt" );
193193

194+
if (!COM_CompareExtension(filename, ".txt"))
195+
{
196+
Com_Printf("Con_Dump_f: Only the \".txt\" extension is supported by this command!\n");
197+
return;
198+
}
199+
194200
f = FS_FOpenFileWrite( filename );
195201
if (!f)
196202
{

Diff for: code/qcommon/common.c

+7
Original file line numberDiff line numberDiff line change
@@ -2975,6 +2975,13 @@ void Com_WriteConfig_f( void ) {
29752975
return;
29762976
}
29772977

2978+
2979+
if (!COM_CompareExtension(filename, ".cfg"))
2980+
{
2981+
Com_Printf("Com_WriteConfig_f: Only the \".cfg\" extension is supported by this command!\n");
2982+
return;
2983+
}
2984+
29782985
Q_strncpyz( filename, Cmd_Argv(1), sizeof( filename ) );
29792986
COM_DefaultExtension( filename, sizeof( filename ), ".cfg" );
29802987
Com_Printf( "Writing %s.\n", filename );

0 commit comments

Comments
 (0)