o rcon now prints (hidden) instead of the rcon password

* taniwha  drops a 900lb security manual on zoid's head
	 <taniwha> nah, make that kg :)
 o  fix a potential buffer overflow
This commit is contained in:
Bill Currie 2000-10-20 18:03:26 +00:00
parent ea766e6203
commit f0c35d7f9d

View file

@ -878,6 +878,7 @@ Redirect all printfs
void SVC_RemoteCommand (void) void SVC_RemoteCommand (void)
{ {
int i; int i;
int len = 0;
char remaining[1024]; char remaining[1024];
if (CheckForFlood(FLOOD_RCON)) return; if (CheckForFlood(FLOOD_RCON)) return;
@ -892,19 +893,19 @@ void SVC_RemoteCommand (void)
} else { } else {
Con_Printf ("Rcon from %s:\n%s\n"
, NET_AdrToString (net_from), net_message.data+4);
SV_BeginRedirect (RD_PACKET);
remaining[0] = 0; remaining[0] = 0;
for (i=2 ; i<Cmd_Argc() ; i++) for (i=2 ; i<Cmd_Argc() ; i++) {
{ strncat (remaining, Cmd_Argv(i), sizeof (remaining) - len - 1);
strcat (remaining, Cmd_Argv(i) ); strncat (remaining, " ", sizeof (remaining) - len - 2);
strcat (remaining, " "); len += strlen (Cmd_Argv (i)) + 1; // +1 for " "
} }
Con_Printf ("Rcon from %s:\nrcon (hidden) %s\n"
, NET_AdrToString (net_from), remaining);
SV_BeginRedirect (RD_PACKET);
Cmd_ExecuteString (remaining); Cmd_ExecuteString (remaining);
} }