From 2260ceb605f5bec752f905c83913d7eae4f64101 Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Mon, 17 Jan 2022 22:32:56 +0100 Subject: [PATCH 1/2] diablo: add BUGFIX for PressChar; out-of-bounds access to dungeon --- Source/diablo.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 48780e7ad..23edca74c 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -1520,6 +1520,7 @@ static void PressChar(WPARAM vkey) if (debug_mode_key_inverted_v) { sprintf(tempstr, "PX = %i PY = %i", plr[myplr]._px, plr[myplr]._py); NetSendCmdString(1 << myplr, tempstr); + // BUGFIX: out-of-bounds access to dungeon; should be `dungeon[(cursmx-16)/2][(cursmy-16)/2]`, was `dungeon[cursmx][cursmy]`. sprintf(tempstr, "CX = %i CY = %i DP = %i", cursmx, cursmy, dungeon[cursmx][cursmy]); NetSendCmdString(1 << myplr, tempstr); } From af5068d3fd0fb8dcb42d65873fcf4ea0f95fee6d Mon Sep 17 00:00:00 2001 From: Robin Eklind Date: Tue, 18 Jan 2022 00:17:35 +0100 Subject: [PATCH 2/2] diablo: update BUGFIX comment of PressChar, should be dPiece not dungeon Pointed out by @galaxyhaxz in https://github.com/diasurgical/devilution/pull/2266#discussion_r786302976 --- Source/diablo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/diablo.cpp b/Source/diablo.cpp index 23edca74c..62450c682 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -1520,7 +1520,7 @@ static void PressChar(WPARAM vkey) if (debug_mode_key_inverted_v) { sprintf(tempstr, "PX = %i PY = %i", plr[myplr]._px, plr[myplr]._py); NetSendCmdString(1 << myplr, tempstr); - // BUGFIX: out-of-bounds access to dungeon; should be `dungeon[(cursmx-16)/2][(cursmy-16)/2]`, was `dungeon[cursmx][cursmy]`. + // BUGFIX: out-of-bounds access to dungeon; should be `dPiece[cursmx][cursmy]`, was `dungeon[cursmx][cursmy]`. sprintf(tempstr, "CX = %i CY = %i DP = %i", cursmx, cursmy, dungeon[cursmx][cursmy]); NetSendCmdString(1 << myplr, tempstr); }