mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -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 <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <limits.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "puzzles.h"
|
#include "puzzles.h"
|
||||||
@ -206,6 +207,8 @@ static const char *validate_params(const game_params *params, bool full)
|
|||||||
{
|
{
|
||||||
if (params->n < 4)
|
if (params->n < 4)
|
||||||
return "Number of points must be at least four";
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user