src/trap: Fix isclearpath out of bound access on levl array
Do isok check apriori to accessing the levl array to filter out dx/dy that have grown too large. This fixes: trap.c:3455:19: runtime error: index 80 out of bounds for type 'rm [80][21]'
This commit is contained in:
+3
-1
@@ -3452,8 +3452,10 @@ isclearpath(
|
|||||||
while (distance-- > 0) {
|
while (distance-- > 0) {
|
||||||
x += dx;
|
x += dx;
|
||||||
y += dy;
|
y += dy;
|
||||||
|
if (!isok(x, y))
|
||||||
|
return FALSE;
|
||||||
typ = levl[x][y].typ;
|
typ = levl[x][y].typ;
|
||||||
if (!isok(x, y) || !ZAP_POS(typ) || closed_door(x, y))
|
if (!ZAP_POS(typ) || closed_door(x, y))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if ((t = t_at(x, y)) != 0
|
if ((t = t_at(x, y)) != 0
|
||||||
&& (is_pit(t->ttyp) || is_hole(t->ttyp) || is_xport(t->ttyp)))
|
&& (is_pit(t->ttyp) || is_hole(t->ttyp) || is_xport(t->ttyp)))
|
||||||
|
|||||||
Reference in New Issue
Block a user