Fix possible out-of-bounds access (reported by qqshka).

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6287 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2022-07-28 02:16:42 +00:00
parent 217a49c08d
commit 52cede2e9f

View file

@ -5020,7 +5020,7 @@ void QCBUILTIN PF_terrain_edit(pubprogfuncs_t *prinst, struct globalvars_s *pr_g
{ {
case ter_ent_get: case ter_ent_get:
{ {
int idx = G_INT(OFS_PARM1); unsigned int idx = G_INT(OFS_PARM1);
if (!mod->numentityinfo) if (!mod->numentityinfo)
Mod_ParseEntities(mod); Mod_ParseEntities(mod);
if (idx >= mod->numentityinfo || !mod->entityinfo[idx].keyvals) if (idx >= mod->numentityinfo || !mod->entityinfo[idx].keyvals)