UltraRogue: add a sanity check to do_fuses().
The d_id field, which indicates which fuse function to call, is now checked to make sure it is not out of range. do_daemons() already checks.
This commit is contained in:
parent
1e2f3f5803
commit
5e60293223
1 changed files with 10 additions and 3 deletions
|
|
@ -282,11 +282,18 @@ do_fuses(int now)
|
|||
{
|
||||
if (--wire->d_time <= 0)
|
||||
{
|
||||
fuse_arg arg;
|
||||
if (wire->d_id < 0 || wire->d_id >= FUSE_MAX)
|
||||
printf("Bad fuse id %d\n", wire->d_id);
|
||||
else if (fuses[wire->d_id].func == NULL)
|
||||
printf("No action for fuse %d!\n", wire->d_id);
|
||||
else
|
||||
{
|
||||
fuse_arg arg;
|
||||
|
||||
arg.varg = wire->d_arg;
|
||||
arg.varg = wire->d_arg;
|
||||
fuses[wire->d_id].func(&arg);
|
||||
}
|
||||
wire->d_type = EMPTY;
|
||||
fuses[wire->d_id].func(&arg);
|
||||
demoncnt -= 1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue