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

@ -67,6 +67,9 @@ do_look(short type)
unsigned char *bitmap;
int changed = 0;
if (CANT_HAPPEN(type != EF_LAND && type != EF_SHIP))
type = EF_SHIP;
if (!snxtitem(&ni, type, player->argp[1]))
return RET_SYN;
if ((bitmap = malloc((WORLD_X * WORLD_Y) / 8)) == 0) {