Fix to multiple buffer overflow bugs in CL_Rcon_f

from Tim Angus in ioquake3
svn 95 git 33a48a0336865a9d21983e4836920cd9f3401101

Fix to multiple buffer overflow bugs in CL_Rcon_f

from http://www.quakesrc.org/forums/viewtopic.php?t=5374
This commit is contained in:
Jonathan Gray 2013-05-07 01:44:27 +10:00
parent 8fc8601e0b
commit fefad8e48c

View file

@ -1210,6 +1210,7 @@ void CL_Connect_f( void ) {
Cvar_Set( "cl_currentServerAddress", server );
}
#define MAX_RCON_MESSAGE 1024
/*
=====================
@ -1220,7 +1221,7 @@ CL_Rcon_f
=====================
*/
void CL_Rcon_f( void ) {
char message[1024];
char message[MAX_RCON_MESSAGE];
int i;
netadr_t to;
@ -1236,14 +1237,14 @@ void CL_Rcon_f( void ) {
message[3] = -1;
message[4] = 0;
strcat (message, "rcon ");
Q_strcat (message, MAX_RCON_MESSAGE, "rcon ");
strcat (message, rcon_client_password->string);
strcat (message, " ");
Q_strcat (message, MAX_RCON_MESSAGE, rcon_client_password->string);
Q_strcat (message, MAX_RCON_MESSAGE, " ");
for (i=1 ; i<Cmd_Argc() ; i++) {
strcat (message, Cmd_Argv(i));
strcat (message, " ");
Q_strcat (message, MAX_RCON_MESSAGE, Cmd_Argv(i));
Q_strcat (message, MAX_RCON_MESSAGE, " ");
}
if ( cls.state >= CA_CONNECTED ) {