mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
Black Box: correct order of validation checks for "F" commands
It doesn't do much good to range-check an argument after using it as an array index.
This commit is contained in:
@ -1067,10 +1067,10 @@ static game_state *execute_move(const game_state *from, const char *move)
|
||||
|
||||
case 'F':
|
||||
sscanf(move+1, "%d", &rangeno);
|
||||
if (ret->exits[rangeno] != LASER_EMPTY)
|
||||
goto badmove;
|
||||
if (!RANGECHECK(ret, rangeno))
|
||||
goto badmove;
|
||||
if (ret->exits[rangeno] != LASER_EMPTY)
|
||||
goto badmove;
|
||||
fire_laser(ret, rangeno);
|
||||
break;
|
||||
|
||||
|
Reference in New Issue
Block a user