mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 08:01:30 -07:00
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:
@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user