Also limit Pegs to at least 1x1 even when not doing full validation

This commit is contained in:
Ben Harris
2023-01-10 00:32:25 +00:00
parent 6e40605f1e
commit b090c82df1

2
pegs.c
View File

@ -183,6 +183,8 @@ static const char *validate_params(const game_params *params, bool full)
{ {
if (full && (params->w <= 3 || params->h <= 3)) if (full && (params->w <= 3 || params->h <= 3))
return "Width and height must both be greater than three"; 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) if (params->w > INT_MAX / params->h)
return "Width times height must not be unreasonably large"; return "Width times height must not be unreasonably large";