engine: client: check for upper bound limit in Key_StringToKeynum

This commit is contained in:
Alibek Omarov
2026-04-17 22:36:19 +05:00
parent bfdfeb3dc0
commit 5e664dc3e9

View File

@@ -200,7 +200,14 @@ static int Key_StringToKeynum( const char *str )
// check for hex code
if( str[0] == '0' && str[1] == 'x' )
return Q_atoi( str );
{
int key = Q_atoi( str );
if( key >= ARRAYSIZE( keys ))
return -1;
return key;
}
// scan for a text match
for( i = 0; i < ARRAYSIZE( keynames ); i++ )