aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Harris <bjh21@bjh21.me.uk>2023-01-10 00:32:25 +0000
committerBen Harris <bjh21@bjh21.me.uk>2023-01-15 16:24:27 +0000
commitb090c82df1527dcf348c96765f10ab5736c68c29 (patch)
treea78e40c1e52399825efb04dad841c93c1bf81efb
parent6e40605f1ed4ecce400faae5b41c03995e7f862c (diff)
downloadpuzzles-b090c82df1527dcf348c96765f10ab5736c68c29.zip
puzzles-b090c82df1527dcf348c96765f10ab5736c68c29.tar.gz
puzzles-b090c82df1527dcf348c96765f10ab5736c68c29.tar.bz2
puzzles-b090c82df1527dcf348c96765f10ab5736c68c29.tar.xz
Also limit Pegs to at least 1x1 even when not doing full validation
-rw-r--r--pegs.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/pegs.c b/pegs.c
index 29fe42e..54d1a21 100644
--- a/pegs.c
+++ b/pegs.c
@@ -183,6 +183,8 @@ static const char *validate_params(const game_params *params, bool full)
{
if (full && (params->w <= 3 || params->h <= 3))
return "Width and height must both be greater than three";
+ if (params->w < 1 || params->h < 1)
+ return "Width and height must both be at least one";
if (params->w > INT_MAX / params->h)
return "Width times height must not be unreasonably large";