From 870e47ed032344b7c8f12797671cfb51ba9473e3 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Fri, 7 Jun 2024 22:22:13 +0300 Subject: [PATCH] engine: ensure character signness when checking for nonprintable characters --- engine/client/cl_qparse.c | 2 +- engine/client/keys.c | 2 +- engine/common/cmd.c | 2 +- engine/server/sv_game.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/engine/client/cl_qparse.c b/engine/client/cl_qparse.c index f65522eb..0171da1d 100644 --- a/engine/client/cl_qparse.c +++ b/engine/client/cl_qparse.c @@ -844,7 +844,7 @@ static void CL_QuakeExecStuff( void ) while( 1 ) { // skip whitespace up to a /n - while( *text && ((byte)*text) <= ' ' && *text != '\r' && *text != '\n' ) + while( *text && ((byte)*text ) <= ' ' && *text != '\r' && *text != '\n' ) text++; if( *text == '\n' || *text == '\r' ) diff --git a/engine/client/keys.c b/engine/client/keys.c index 529e1e51..5064a0a6 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -553,7 +553,7 @@ static void Key_AddKeyCommands( int key, const char *kb, qboolean down ) } buttonPtr = button; - while(( kb[i] <= ' ' || kb[i] == ';' ) && kb[i] != 0 ) + while((((byte)kb[i]) <= ' ' || kb[i] == ';' ) && kb[i] != 0 ) i++; } diff --git a/engine/common/cmd.c b/engine/common/cmd.c index 1e8837b3..3ba8dd1a 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -640,7 +640,7 @@ void Cmd_TokenizeString( const char *text ) while( 1 ) { // skip whitespace up to a /n - while( *text && *text <= ' ' && *text != '\r' && *text != '\n' ) + while( *text && ((byte)*text ) <= ' ' && *text != '\r' && *text != '\n' ) text++; if( *text == '\n' || *text == '\r' ) diff --git a/engine/server/sv_game.c b/engine/server/sv_game.c index b9dabf42..c5455429 100644 --- a/engine/server/sv_game.c +++ b/engine/server/sv_game.c @@ -256,7 +256,7 @@ void GAME_EXPORT SV_SetModel( edict_t *ent, const char *modelname ) return; } - if( !modelname || modelname[0] <= ' ' ) + if( !modelname || ((byte)modelname[0] ) <= ' ' ) { Con_Printf( S_WARN "SV_SetModel: null name\n" ); return;