Skip to content

Commit

Permalink
Fix: heap-use-after-free when magic beam trap is destroyed by fire ra…
Browse files Browse the repository at this point in the history
…y when situated on ice. Fixes #483
  • Loading branch information
elunna committed Sep 25, 2023
1 parent e356f90 commit 6244ebc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/trap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1194,12 +1194,12 @@ unsigned trflags;
seetrap(trap);
if (isok(trap->launch.x, trap->launch.y)
&& IS_STWALL(levl[trap->launch.x][trap->launch.y].typ)) {

trap->once = 1; /* Set before dobuzz because a fire ray can
* destroy a magic beam trap on top of ice. */
dobuzz(randomray(), 8,
trap->launch.x, trap->launch.y,
sgn(trap->tx - trap->launch.x),
sgn(trap->ty - trap->launch.y), FALSE);
trap->once = 1;
} else {
deltrap(trap);
newsym(u.ux, u.uy);
Expand Down

0 comments on commit 6244ebc

Please sign in to comment.