diff --git a/sixteen.c b/sixteen.c index aa10f4a..7c9e7aa 100644 --- a/sixteen.c +++ b/sixteen.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include "puzzles.h" @@ -173,6 +174,8 @@ static const char *validate_params(const game_params *params, bool full) { if (params->w < 2 || params->h < 2) return "Width and height must both be at least two"; + if (params->w > INT_MAX / params->h) + return "Width times height must not be unreasonably large"; return NULL; }