Skip to content

Commit

Permalink
engine: server: escape rcon arguments before passing it to command bu…
Browse files Browse the repository at this point in the history
…ffer, also use more efficient concatenation
  • Loading branch information
a1batross committed Jun 18, 2023
1 parent 2a05624 commit 01ad3dd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions engine/server/sv_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,7 @@ void SV_RemoteCommand( netadr_t from, sizebuf_t *msg )
static char outputbuf[2048];
const char *adr;
char remaining[1024];
char *p = remaining;
int i;

if( !rcon_enable.value || !COM_CheckStringEmpty( rcon_password.string ))
Expand All @@ -1094,8 +1095,9 @@ void SV_RemoteCommand( netadr_t from, sizebuf_t *msg )
remaining[0] = 0;
for( i = 2; i < Cmd_Argc(); i++ )
{
Q_strncat( remaining, Cmd_Argv( i ), sizeof( remaining ));
Q_strncat( remaining, " ", sizeof( remaining ));
p += Q_strncpy( p, "\"", sizeof( remaining ) - ( p - remaining ));
p += Q_strncpy( p, Cmd_Argv( i ), sizeof( remaining ) - ( p - remaining ));
p += Q_strncpy( p, "\" ", sizeof( remaining ) - ( p - remaining ));
}
Cmd_ExecuteString( remaining );

Expand Down

0 comments on commit 01ad3dd

Please sign in to comment.