engine: common: cvar: fix buffer overflow in Cvar_ValidateString

This commit is contained in:
Alibek Omarov 2023-08-03 01:12:16 +03:00
parent c1c27c5f18
commit e017b9145f

View File

@ -211,7 +211,7 @@ const char *Cvar_ValidateString( convar_t *var, const char *value )
int len = 0; int len = 0;
// step through the string, only copying back in characters that are printable // step through the string, only copying back in characters that are printable
while( *pszValue && len < MAX_STRING ) while( *pszValue && len < ( MAX_STRING - 1 ))
{ {
if( ((byte)*pszValue) < 32 ) if( ((byte)*pszValue) < 32 )
{ {