mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Undead: fix buffer overrun in "M" command
The guessable squares are numbered up to num_total, not "wh". The latter includes mirror squares that aren't included in the various arrays describing the game state. To reproduce the problem, build Undead with AddressSanitizer and press "M".
This commit is contained in:
2
undead.c
2
undead.c
@ -2103,7 +2103,7 @@ static game_state *execute_move(const game_state *state, const char *move)
|
||||
* approach of starting off in that state and eliminating
|
||||
* things.
|
||||
*/
|
||||
for (i = 0; i < ret->common->wh; i++)
|
||||
for (i = 0; i < ret->common->num_total; i++)
|
||||
if (ret->guess[i] == 7)
|
||||
ret->pencils[i] = 7;
|
||||
move++;
|
||||
|
Reference in New Issue
Block a user