# HG changeset patch # User John "Elwin" Edwards # Date 1511558530 18000 # Node ID d815c40c3753a5613c5e2bd4b611300027246e37 # Parent b8919055c2fc894967ee2d2bd2c8a39959aa17cb 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. diff -r b8919055c2fc -r d815c40c3753 urogue/daemon.c --- a/urogue/daemon.c Fri Nov 24 13:22:26 2017 -0500 +++ b/urogue/daemon.c Fri Nov 24 16:22:10 2017 -0500 @@ -282,11 +282,18 @@ { 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; } }