From e017b9145f2ac958cf6ff9fc0e9ceaae910706ea Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 3 Aug 2023 01:12:16 +0300 Subject: [PATCH] engine: common: cvar: fix buffer overflow in Cvar_ValidateString --- engine/common/cvar.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/engine/common/cvar.c b/engine/common/cvar.c index 574c25cf..81a37ce2 100644 --- a/engine/common/cvar.c +++ b/engine/common/cvar.c @@ -211,7 +211,7 @@ const char *Cvar_ValidateString( convar_t *var, const char *value ) int len = 0; // 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 ) {