From 2356bc9905c7740120c9a5c7f3fc80573f7ec1e2 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Tue, 16 Nov 2021 15:56:41 +0300 Subject: [PATCH] engine: client: escape keybindings and rcon commands --- engine/client/cl_main.c | 6 +++++- engine/client/keys.c | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 58087f49..5a17bfb2 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -1306,7 +1306,11 @@ void CL_Rcon_f( void ) for( i = 1; i < Cmd_Argc(); i++ ) { - Q_strcat( message, Cmd_Argv( i )); + string commmand; + + Cmd_Escape( command, Cmd_Argv( i ), sizeof( command )); + + Q_strcat( message, command ); Q_strcat( message, " " ); } diff --git a/engine/client/keys.c b/engine/client/keys.c index 0dbad2c2..fce03218 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -462,6 +462,7 @@ Writes lines containing "bind key value" void Key_WriteBindings( file_t *f ) { int i; + string newCommand; if( !f ) return; @@ -472,7 +473,8 @@ void Key_WriteBindings( file_t *f ) if( !COM_CheckString( keys[i].binding )) continue; - FS_Printf( f, "bind %s \"%s\"\n", Key_KeynumToString( i ), keys[i].binding ); + Cmd_Escape( newCommand, keys[i].binding, sizeof( newCommand )); + FS_Printf( f, "bind %s \"%s\"\n", Key_KeynumToString( i ), newCommand ); } }