Skip to content

Commit

Permalink
Shared: Disallow intentionally writing to default configs.
Browse files Browse the repository at this point in the history
  • Loading branch information
ensiform committed Mar 14, 2017
1 parent 8956a35 commit 4654c46
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions code/qcommon/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1246,6 +1246,12 @@ void Com_WriteConfig_f( void ) {
return;
}

if(!FS_FilenameCompare(filename, "mpdefault.cfg") || !FS_FilenameCompare(filename, "default.cfg"))
{
Com_Printf( S_COLOR_YELLOW "Com_WriteConfig_f: The filename \"%s\" is reserved! Please choose another name.\n", filename );
return;
}

Com_Printf( "Writing %s.\n", filename );
Com_WriteConfigToFile( filename );
}
Expand Down
6 changes: 6 additions & 0 deletions codemp/qcommon/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1364,6 +1364,12 @@ void Com_WriteConfig_f( void ) {
return;
}

if(!FS_FilenameCompare(filename, "mpdefault.cfg") || !FS_FilenameCompare(filename, "default.cfg"))
{
Com_Printf( S_COLOR_YELLOW "Com_WriteConfig_f: The filename \"%s\" is reserved! Please choose another name.\n", filename );
return;
}

Com_Printf( "Writing %s.\n", filename );
Com_WriteConfigToFile( filename );
}
Expand Down

0 comments on commit 4654c46

Please sign in to comment.