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
|
@ -433,6 +433,22 @@ char *Cmd_Cmd(void)
|
|||
return cmd_cmd;
|
||||
}
|
||||
|
||||
/*
|
||||
Replace command separators with space to prevent interpretation
|
||||
This is a hack to protect buggy qvms
|
||||
https://bugzilla.icculus.org/show_bug.cgi?id=3593
|
||||
*/
|
||||
void Cmd_Args_Sanitize( void ) {
|
||||
int i;
|
||||
for ( i = 1 ; i < cmd_argc ; i++ ) {
|
||||
char* c = cmd_argv[i];
|
||||
while ((c = strpbrk(c, "\n\r;"))) {
|
||||
*c = ' ';
|
||||
++c;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
Cmd_TokenizeString
|
||||
|
|
|
@ -434,6 +434,7 @@ char *Cmd_Args (void);
|
|||
char *Cmd_ArgsFrom( int arg );
|
||||
void Cmd_ArgsBuffer( char *buffer, int bufferLength );
|
||||
char *Cmd_Cmd (void);
|
||||
void Cmd_Args_Sanitize( void );
|
||||
// The functions that execute commands get their parameters with these
|
||||
// functions. Cmd_Argv () will return an empty string, not a NULL
|
||||
// if arg > argc, so string operations are allways safe.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue