From 74aa934441351334e40d8963900b8a2fbc9bc9cd Mon Sep 17 00:00:00 2001 From: Patric Stout Date: Mon, 1 Mar 2021 13:12:17 +0100 Subject: Codechange: validate that "max" value of settings fit in their storage This is an easy mistake to make, so protect us against making such mistakes, by validating it doesn't happen. --- src/table/company_settings.ini | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/table/company_settings.ini') diff --git a/src/table/company_settings.ini b/src/table/company_settings.ini index e685ff6dc..eea2371fc 100644 --- a/src/table/company_settings.ini +++ b/src/table/company_settings.ini @@ -20,6 +20,9 @@ SDT_BOOL = SDT_BOOL($base, $var, $flags, $guiflags, $def, SDT_VAR = SDT_VAR($base, $var, $type, $flags, $guiflags, $def, $min, $max, $interval, $str, $strhelp, $strval, $proc, $from, $to, $cat, $extra, $startup), SDT_END = SDT_END() +[validation] +SDT_VAR = static_assert($max <= MAX_$type, "Maximum value for $base.$var exceeds storage size"); + [defaults] flags = 0 guiflags = SGF_PER_COMPANY -- cgit v1.2.3-54-g00ecf