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:
parent
990b39edec
commit
5490782db3
7 changed files with 52 additions and 9 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -61,6 +61,9 @@ radar(short type)
|
|||
char buf[1024];
|
||||
char prompt[80];
|
||||
|
||||
if (CANT_HAPPEN(type != EF_LAND && type != EF_SHIP))
|
||||
type = EF_SHIP;
|
||||
|
||||
sprintf(prompt, "Radar from (%s # or sector(s)) : ", ef_nameof(type));
|
||||
cp = getstarg(player->argp[1], prompt, buf);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue