diff options
| author | Simon Tatham <anakin@pobox.com> | 2020-03-17 18:12:33 +0000 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2020-03-17 18:12:33 +0000 |
| commit | d71ac73d8a4397c35b21ec08388a1c6f94691b64 (patch) | |
| tree | 28de7fbe3af79aa4500cad0cb862361c6d822e39 | |
| parent | d022a1c11c185027fad937cbe9cd2c318025ee04 (diff) | |
| download | puzzles-d71ac73d8a4397c35b21ec08388a1c6f94691b64.zip puzzles-d71ac73d8a4397c35b21ec08388a1c6f94691b64.tar.gz puzzles-d71ac73d8a4397c35b21ec08388a1c6f94691b64.tar.bz2 puzzles-d71ac73d8a4397c35b21ec08388a1c6f94691b64.tar.xz | |
Mines: add validation for negative mine count.
If this gets through validation, it causes an infinite loop after
gameplay begins.
| -rw-r--r-- | mines.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -258,6 +258,8 @@ static const char *validate_params(const game_params *params, bool full) */ if (full && params->unique && (params->w <= 2 || params->h <= 2)) return "Width and height must both be greater than two"; + if (params->n < 0) + return "Mine count may not be negative"; if (params->n > params->w * params->h - 9) return "Too many mines for grid size"; |