mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 23:51:29 -07:00
Same Game: reject moves with unexpected characters in
Previously if a move string starting with "M" contained anything else other than a digit or a comma, execute_move() would spin trying to parse it. Now it returns NULL.
This commit is contained in:
@ -1346,6 +1346,10 @@ static game_state *execute_move(const game_state *from, const char *move)
|
||||
move++;
|
||||
|
||||
while (*move) {
|
||||
if (!isdigit((unsigned char)*move)) {
|
||||
free_game(ret);
|
||||
return NULL;
|
||||
}
|
||||
i = atoi(move);
|
||||
if (i < 0 || i >= ret->n) {
|
||||
free_game(ret);
|
||||
|
Reference in New Issue
Block a user