{
int i;
char *s = string + 5;
+ char *endpos = string + length + 1; // one behind the NUL, so adding strlen+1 will eventually reach it
char password[64];
for (i = 0;*s > ' ';s++)
if (i < (int)sizeof(password) - 1)
if (password[0] > ' ' && !strcmp(rcon_password.string, password))
{
// looks like a legitimate rcon command with the correct password
- Con_Printf("server received rcon command from %s:\n%s\n", host_client ? host_client->name : addressstring2, s);
+ char *s_ptr = s;
+ while(s_ptr != endpos)
+ {
+ size_t l = strlen(s_ptr);
+ if(l)
+ Con_Printf("server received rcon command from %s:\n%s\n", host_client ? host_client->name : addressstring2, s_ptr);
+ s_ptr += l + 1;
+ }
rcon_redirect = true;
rcon_redirect_bufferpos = 0;
- Cmd_ExecuteString(s, src_command);
+ while(s != endpos)
+ {
+ size_t l = strlen(s);
+ if(l)
+ Cmd_ExecuteString(s, src_command);
+ s += l + 1;
+ }
rcon_redirect_buffer[rcon_redirect_bufferpos] = 0;
rcon_redirect = false;
// print resulting text to client