From b6067e102e92cb61ced4fa369b4a6b0a90d6ed98 Mon Sep 17 00:00:00 2001 From: "John \"Elwin\" Edwards" Date: Thu, 21 Oct 2021 21:00:15 -0400 Subject: [PATCH] Advanced Rogue 7: fix a crash when casting magic missile. do_zap() dereferenced a struct object pointer while ignoring the result of a NULL check. XRogue had the same problem, though triggering it was unlikely, since XRogue does not include a magic missile spell. Reported by John Harris of @Play. --- arogue7/sticks.c | 2 +- xrogue/sticks.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arogue7/sticks.c b/arogue7/sticks.c index b6be4d5..0fe196b 100644 --- a/arogue7/sticks.c +++ b/arogue7/sticks.c @@ -309,7 +309,7 @@ do_zap(struct thing *zapper, struct object *obj, coord *direction, int which, if (!obj) dice = zapper->t_stats.s_lvl; - if (obj->o_type == RELIC) + else if (obj->o_type == RELIC) dice = 15; else if (EQUAL(ws_type[which], "staff")) dice = 10; diff --git a/xrogue/sticks.c b/xrogue/sticks.c index 19bdd7a..71248ba 100644 --- a/xrogue/sticks.c +++ b/xrogue/sticks.c @@ -323,7 +323,7 @@ do_zap(struct thing *zapper, struct object *obj, coord *direction, int which, if (!obj) dice = zapper->t_stats.s_lvl; - if (obj->o_type == RELIC) + else if (obj->o_type == RELIC) dice = 15; else if (EQUAL(ws_type[which], "staff")) dice = 10;