Last-ditch point-count limit for Untangle

Anything over INT_MAX/3 will cause an integer overflow, so put the
limit there for now.
This commit is contained in:
Ben Harris
2023-01-10 20:46:24 +00:00
parent 85ccdf2f75
commit d5b8a20def

View File

@ -31,6 +31,7 @@
#include <string.h>
#include <assert.h>
#include <ctype.h>
#include <limits.h>
#include <math.h>
#include "puzzles.h"
@ -206,6 +207,8 @@ static const char *validate_params(const game_params *params, bool full)
{
if (params->n < 4)
return "Number of points must be at least four";
if (params->n > INT_MAX / 3)
return "Number of points must not be unreasonably large";
return NULL;
}