diff options
| author | Ben Harris <bjh21@bjh21.me.uk> | 2023-01-10 20:46:24 +0000 |
|---|---|---|
| committer | Ben Harris <bjh21@bjh21.me.uk> | 2023-01-15 16:24:27 +0000 |
| commit | d5b8a20def7634d4df79800fe54d8e34c6353974 (patch) | |
| tree | ae6cee02c1a0946e8efd971305de24feda9c1271 | |
| parent | 85ccdf2f75e3ea55d5e92d9790e50394e1bec089 (diff) | |
| download | puzzles-d5b8a20def7634d4df79800fe54d8e34c6353974.zip puzzles-d5b8a20def7634d4df79800fe54d8e34c6353974.tar.gz puzzles-d5b8a20def7634d4df79800fe54d8e34c6353974.tar.bz2 puzzles-d5b8a20def7634d4df79800fe54d8e34c6353974.tar.xz | |
Last-ditch point-count limit for Untangle
Anything over INT_MAX/3 will cause an integer overflow, so put the
limit there for now.
| -rw-r--r-- | untangle.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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; } |