diff options
| author | Simon Tatham <anakin@pobox.com> | 2005-07-29 11:24:55 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2005-07-29 11:24:55 +0000 |
| commit | 178a86197b8b769bac35a7032313572551614a4d (patch) | |
| tree | e2fdf3f25ea7e389a2fa2eee7bebe23e3c4c9af7 | |
| parent | 19c9453b5c4a1ee0afaf9b85d2c107b70c627cd0 (diff) | |
| download | puzzles-178a86197b8b769bac35a7032313572551614a4d.zip puzzles-178a86197b8b769bac35a7032313572551614a4d.tar.gz puzzles-178a86197b8b769bac35a7032313572551614a4d.tar.bz2 puzzles-178a86197b8b769bac35a7032313572551614a4d.tar.xz | |
Patches from Ben Hutchings to fix failures of sscanf error checking.
[originally from svn r6147]
| -rw-r--r-- | mines.c | 2 | ||||
| -rw-r--r-- | pegs.c | 2 |
2 files changed, 2 insertions, 2 deletions
@@ -2370,7 +2370,7 @@ static char *encode_ui(game_ui *ui) static void decode_ui(game_ui *ui, char *encoding) { - int p; + int p= 0; sscanf(encoding, "D%d%n", &ui->deaths, &p); if (encoding[p] == 'C') ui->completed = TRUE; @@ -869,7 +869,7 @@ static game_state *execute_move(game_state *state, char *move) int sx, sy, tx, ty; game_state *ret; - if (sscanf(move, "%d,%d-%d,%d", &sx, &sy, &tx, &ty)) { + if (sscanf(move, "%d,%d-%d,%d", &sx, &sy, &tx, &ty) == 4) { int mx, my, dx, dy; if (sx < 0 || sx >= w || sy < 0 || sy >= h) |