diff --git a/configure.ac b/configure.ac index c5e01009c..8ed7441b5 100644 --- a/configure.ac +++ b/configure.ac @@ -898,9 +898,12 @@ AC_HELP_STRING([--with-nicklen=LENGTH],[Set the upper-bound nick length to LENGT if ! expr "$withval" + 0 >/dev/null 2>&1; then AC_ERROR([NICKLEN must be a numeric value]) fi - if test $withval -ge 50; then + if test $withval -gt 50; then NICKLEN=50 AC_MSG_WARN([NICKLEN has a hard limit of 50. Setting NICKLEN=50]) + elif test $withval -lt 9; then + NICKLEN=9 + AC_MSG_WARN([NICKLEN has a lower limit of 9. Setting NICKLEN=9]) else NICKLEN="$withval" fi diff --git a/src/newconf.c b/src/newconf.c index eac863c0a..8447201ed 100644 --- a/src/newconf.c +++ b/src/newconf.c @@ -268,9 +268,15 @@ conf_set_serverinfo_nicklen(void *data) if (ConfigFileEntry.nicklen > NICKLEN) { conf_report_error("Warning -- ignoring serverinfo::nicklen -- provided nicklen (%u) is greater than allowed nicklen (%u)", - ConfigFileEntry.nicklen, NICKLEN); + ConfigFileEntry.nicklen - 1, NICKLEN - 1); ConfigFileEntry.nicklen = NICKLEN; } + else if (ConfigFileEntry.nicklen < 9 + 1) + { + conf_report_error("Warning -- serverinfo::nicklen is too low (%u) -- forcing 9", + ConfigFileEntry.nicklen); + ConfigFileEntry.nicklen = 9 + 1; + } } static void