]> granicus.if.org Git - nethack/commit
get_adjacent_loc()
authornethack.allison <nethack.allison>
Sun, 17 Nov 2002 18:43:45 +0000 (18:43 +0000)
committernethack.allison <nethack.allison>
Sun, 17 Nov 2002 18:43:45 +0000 (18:43 +0000)
commitabd3df287141c9d6b2e15885b57498660d4ab092
treec6a6cfb58d5614adde43c2b177b77359ebef990c
parent330bdb7d1ad386825580dec3ef431e00f3f6d7e8
get_adjacent_loc()

use get_adjacent_loc() rather than getdir() directly for some things where
you want to ensure valid adjacent coordinates are returned

<email deleted> wrote:
>>> [...]
>>> I've noticed that the loot adjacent spot code doesn't have any
>>> isok(x,y) test, so will risk crashing if used at the edge of
>>> the screen (whether deliberately, or accidentally due to being
>>> confused or stunned when picking the direction).

>> Would this not be a problem elsewhere, such as use_leash() too?

> Yes, that looks like the same risk. getdir() doesn't validate
> that the <u.ux+u.dx, u.uy,u.dy> is safe and neither does m_at(),
> so their callers need to.
>
> I did manage to provoke a crash with #loot on the plane of earth,
> although an accidental case would be a lot less likely to happen.
doc/fixes34.1
include/extern.h
src/apply.c
src/cmd.c
src/pickup.c