security fix: prevent command injection via callvote
This commit is contained in:
parent
cde5fcfb9b
commit
f5aae78481
4 changed files with 29 additions and 3 deletions
|
@ -1213,6 +1213,7 @@ Cmd_CallVote_f
|
|||
==================
|
||||
*/
|
||||
void Cmd_CallVote_f( gentity_t *ent ) {
|
||||
char* c;
|
||||
int i;
|
||||
char arg1[MAX_STRING_TOKENS];
|
||||
char arg2[MAX_STRING_TOKENS];
|
||||
|
@ -1239,9 +1240,16 @@ void Cmd_CallVote_f( gentity_t *ent ) {
|
|||
trap_Argv( 1, arg1, sizeof( arg1 ) );
|
||||
trap_Argv( 2, arg2, sizeof( arg2 ) );
|
||||
|
||||
if( strchr( arg1, ';' ) || strchr( arg2, ';' ) ) {
|
||||
trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string.\n\"" );
|
||||
return;
|
||||
// check for command separators in arg2
|
||||
for( c = arg2; *c; ++c) {
|
||||
switch(*c) {
|
||||
case '\n':
|
||||
case '\r':
|
||||
case ';':
|
||||
trap_SendServerCommand( ent-g_entities, "print \"Invalid vote string.\n\"" );
|
||||
return;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !Q_stricmp( arg1, "map_restart" ) ) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue