out of bounds memory access during zap bounce
Apply the diff from entrez to deal with out of array bounds access by wand or spell zap when deciding whether to bounce if that zap reached the extreme edge of the map (not just the edge of the portion of the map in use by current level).
This commit is contained in:
22
src/zap.c
22
src/zap.c
@@ -4477,9 +4477,9 @@ dobuzz(
|
||||
boolean fireball;
|
||||
|
||||
make_bounce:
|
||||
bchance = (levl[sx][sy].typ == STONE) ? 10
|
||||
: (In_mines(&u.uz) && IS_WALL(levl[sx][sy].typ)) ? 20
|
||||
: 75;
|
||||
bchance = (!isok(sx, sy) || levl[sx][sy].typ == STONE) ? 10
|
||||
: (In_mines(&u.uz) && IS_WALL(levl[sx][sy].typ)) ? 20
|
||||
: 75;
|
||||
bounce = 0;
|
||||
fireball = (type == ZT_SPELL(ZT_FIRE));
|
||||
if ((--range > 0 && isok(lsx, lsy) && cansee(lsx, lsy))
|
||||
@@ -4532,16 +4532,12 @@ dobuzz(
|
||||
if (type == ZT_SPELL(ZT_FIRE))
|
||||
explode(sx, sy, type, d(12, 6), 0, EXPL_FIERY);
|
||||
if (shopdamage)
|
||||
pay_for_damage(abstype == ZT_FIRE
|
||||
? "burn away"
|
||||
: abstype == ZT_COLD
|
||||
? "shatter"
|
||||
/* "damage" indicates wall rather than door */
|
||||
: abstype == ZT_ACID
|
||||
? "damage"
|
||||
: abstype == ZT_DEATH
|
||||
? "disintegrate"
|
||||
: "destroy",
|
||||
pay_for_damage(abstype == ZT_FIRE ? "burn away"
|
||||
: abstype == ZT_COLD ? "shatter"
|
||||
/* "damage" indicates wall rather than door */
|
||||
: abstype == ZT_ACID ? "damage"
|
||||
: abstype == ZT_DEATH ? "disintegrate"
|
||||
: "destroy",
|
||||
FALSE);
|
||||
g.bhitpos = save_bhitpos;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user