Check ef_type before dereferencing struct empobj

Such manual checking is error prone, but the best we can do right now.
This commit is contained in:
Markus Armbruster 2008-02-25 20:57:33 +01:00
parent 990b39edec
commit 5490782db3
7 changed files with 52 additions and 9 deletions

View file

@ -349,6 +349,10 @@ unit_map(int unit_type, int uid, struct nstr_sect *nsp, char *originp)
struct range range;
char *name;
if (CANT_HAPPEN((ef_flags(unit_type) & (EFF_OWNER | EFF_XY))
!= (EFF_OWNER | EFF_XY)))
return RET_FAIL;
if (!get_empobj(unit_type, uid, &unit))
return RET_FAIL;
if (!player->owner || unit.gen.own == 0)