mirror of
https://github.com/YGGverse/xash3d-fwgs.git
synced 2025-01-17 18:40:02 +00:00
engine: server: escape rcon arguments before passing it to command buffer, also use more efficient concatenation
This commit is contained in:
parent
2a05624615
commit
01ad3dda2a
@ -1077,6 +1077,7 @@ void SV_RemoteCommand( netadr_t from, sizebuf_t *msg )
|
|||||||
static char outputbuf[2048];
|
static char outputbuf[2048];
|
||||||
const char *adr;
|
const char *adr;
|
||||||
char remaining[1024];
|
char remaining[1024];
|
||||||
|
char *p = remaining;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if( !rcon_enable.value || !COM_CheckStringEmpty( rcon_password.string ))
|
if( !rcon_enable.value || !COM_CheckStringEmpty( rcon_password.string ))
|
||||||
@ -1094,8 +1095,9 @@ void SV_RemoteCommand( netadr_t from, sizebuf_t *msg )
|
|||||||
remaining[0] = 0;
|
remaining[0] = 0;
|
||||||
for( i = 2; i < Cmd_Argc(); i++ )
|
for( i = 2; i < Cmd_Argc(); i++ )
|
||||||
{
|
{
|
||||||
Q_strncat( remaining, Cmd_Argv( i ), sizeof( remaining ));
|
p += Q_strncpy( p, "\"", sizeof( remaining ) - ( p - remaining ));
|
||||||
Q_strncat( remaining, " ", sizeof( remaining ));
|
p += Q_strncpy( p, Cmd_Argv( i ), sizeof( remaining ) - ( p - remaining ));
|
||||||
|
p += Q_strncpy( p, "\" ", sizeof( remaining ) - ( p - remaining ));
|
||||||
}
|
}
|
||||||
Cmd_ExecuteString( remaining );
|
Cmd_ExecuteString( remaining );
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user