ref: 85ccdf2f75e3ea55d5e92d9790e50394e1bec089
parent: 51dcf4add6e046568557cee2fa01975f14716889
author: Ben Harris <bjh21@bjh21.me.uk>
date: Tue Jan 10 15:34:06 EST 2023
Adjust Undead upper grid-size limit to avoid overflow
--- a/undead.c
+++ b/undead.c
@@ -193,9 +193,9 @@
static const char *validate_params(const game_params *params, bool full)
{
- if ((params->w * params->h ) > 54) return "Grid is too big";
if (params->w < 3) return "Width must be at least 3";
if (params->h < 3) return "Height must be at least 3";
+ if (params->w > 54 / params->h) return "Grid is too big";
if (params->diff >= DIFFCOUNT) return "Unknown difficulty rating";
return NULL;
}