Skip to content

Commit 97f8fa2

Browse files
committed
Fix: prevent boomerang going out of map.
From NetHack 3.7 commit 575d8c0 - caught this one while fuzzing.
1 parent a5114ee commit 97f8fa2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

doc/evilhack-changelog.md

+1
Original file line numberDiff line numberDiff line change
@@ -4362,4 +4362,5 @@ The following changes to date are:
43624362
- Fix: grammar feedback when spells like barkskin or stoneskin wear off
43634363
- Fix: portal to quest would sometimes not spawn if entry portal spawned
43644364
on Aphrodite's Garden or the Desolate Forest levels
4365+
- Fix: prevent boomerang going out of map
43654366

src/zap.c

+5
Original file line numberDiff line numberDiff line change
@@ -4536,6 +4536,11 @@ int dx, dy;
45364536
dy = ydir[i];
45374537
bhitpos.x += dx;
45384538
bhitpos.y += dy;
4539+
if (!isok(bhitpos.x, bhitpos.y)) {
4540+
bhitpos.x -= dx;
4541+
bhitpos.y -= dy;
4542+
break;
4543+
}
45394544
if ((mtmp = m_at(bhitpos.x, bhitpos.y)) != 0) {
45404545
m_respond(mtmp);
45414546
tmp_at(DISP_END, 0);

0 commit comments

Comments
 (0)