From ae9d0666afe45b56b91613c190cc18d2ea174895 Mon Sep 17 00:00:00 2001 From: Attila Molnar Date: Thu, 18 Sep 2014 01:55:17 +0200 Subject: [PATCH] wumpus: Fix use after free leading to possible memory corruption when the wumpus eats a player CID: 1170468 --- wumpus.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wumpus.c b/wumpus.c index 8c3c21c..eecfb7f 100644 --- a/wumpus.c +++ b/wumpus.c @@ -630,9 +630,11 @@ move_wumpus(void *unused) /* player_t *p has been eaten and is no longer in the game */ resign_player(p); } - - /* prepare for the next turn */ - p->has_moved = false; + else + { + /* prepare for the next turn */ + p->has_moved = false; + } } /* report any wumpus kills */