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.
This commit is contained in:
@@ -172,6 +172,7 @@ E int FDECL(movecmd, (CHAR_P));
|
||||
E int FDECL(getdir, (const char *));
|
||||
E void NDECL(confdir);
|
||||
E int FDECL(isok, (int,int));
|
||||
E int FDECL(get_adjacent_loc, (const char *, const char *, XCHAR_P, XCHAR_P, coord *));
|
||||
E const char *FDECL(click_to_cmd, (int,int,int));
|
||||
E char NDECL(readchar);
|
||||
#ifdef WIZARD
|
||||
|
||||
Reference in New Issue
Block a user