From: cloudwalk Date: Mon, 8 Jun 2020 22:12:18 +0000 (+0000) Subject: Add missing modulo in cvar hashtable lookup X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=9fbd7527f5af87f73559110b22c6c689ea824d97;p=xonotic%2Fdarkplaces.git Add missing modulo in cvar hashtable lookup git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12657 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/cvar.c b/cvar.c index fdd39e27..7022f085 100644 --- a/cvar.c +++ b/cvar.c @@ -79,7 +79,7 @@ static cvar_hash_t *Cvar_FindVarLink(cvar_state_t *cvars, const char *var_name, cvar_hash_t *hash; // use hash lookup to minimize search time - hashindex = CRC_Block((const unsigned char *)var_name, strlen(var_name)); + hashindex = CRC_Block((const unsigned char *)var_name, strlen(var_name)) % CVAR_HASHSIZE; if(parent) *parent = NULL; if(prev_alpha) *prev_alpha = NULL; if(link) *link = &cvars->hashtable[hashindex];