From b73de3c4973f528c58ab0c83752d67c33fcdf6f4 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Tue, 22 Jul 2003 17:01:58 +0000 Subject: [PATCH] - Will now error at too large cloak keys (2147483647 and greater) because it's dangerous and could cause cloak key differences (ex: mixed ia32&ia64 networks). --- Changes | 2 ++ src/s_conf.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/Changes b/Changes index cdfdbf811..15451dd04 100644 --- a/Changes +++ b/Changes @@ -2277,3 +2277,5 @@ seen. gmtime warning still there - Clarified what ban server {} does, suggested by Joolz (#0001110) - Fixed a problem related to crontab reported by LRL (#0001034) - Fixed a problem in PPC detection +- Will now error at too large cloak keys (2147483647 and greater) because it's dangerous + and could cause cloak key differences (ex: mixed ia32&ia64 networks). diff --git a/src/s_conf.c b/src/s_conf.c index c759693db..9948c25fd 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -5711,6 +5711,20 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) errors++; continue; } + /* values which are >LONG_MAX are (re)set to LONG_MAX, problem is + * that 'long' could be 32 or 64 bits resulting in different limits (LONG_MAX), + * which then again results in different cloak keys. + * We could warn/error here or silently reset them to 2147483647... + * IMO it's best to error because the value 2147483647 would be predictable + * (actually that's even unrelated to this 64bit problem). + */ + if ((l1 >= 2147483647) || (l2 >= 2147483647) || (l3 >= 2147483647)) + { + config_error("%s:%i: set::cloak-keys: values must be below 2147483647 (2^31-1)", + cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + errors++; + continue; + } requiredstuff.settings.cloakkeys = 1; } else if (!strcmp(cep->ce_varname, "scan")) {