From f31a400bac0b72e773e32d2a17ac839145dded2b Mon Sep 17 00:00:00 2001 From: Franklin Wei Date: Wed, 16 Aug 2017 11:37:10 -0400 Subject: puzzles: add more parameter validation checks Fixes some annoying crashes. Change-Id: If3c293bd90e301c3e697d1e5fcb1b0aa2ea320fb --- apps/plugins/puzzles/src/mines.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'apps/plugins/puzzles/src/mines.c') diff --git a/apps/plugins/puzzles/src/mines.c b/apps/plugins/puzzles/src/mines.c index 3bfe832..4bee0f3 100644 --- a/apps/plugins/puzzles/src/mines.c +++ b/apps/plugins/puzzles/src/mines.c @@ -265,6 +265,8 @@ static char *validate_params(const game_params *params, int full) return "Width and height must both be greater than two"; if (params->n > params->w * params->h - 9) return "Too many mines for grid size"; + if (params->n < 1) + return "Number of mines must be greater than zero"; /* * FIXME: Need more constraints here. Not sure what the -- cgit v1.1