From: brain Date: Fri, 18 Aug 2006 16:51:20 +0000 (+0000) Subject: Dont allow an empty key (thanks stskeeps) X-Git-Tag: v2.0.23~7359 X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=592f23e7053cb81b076057918c3459a3ba0f5317;p=user%2Fhenk%2Fcode%2Finspircd.git Dont allow an empty key (thanks stskeeps) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4957 e03df62e-2008-0410-955e-edbf42e46eb7 --- diff --git a/src/modes/cmode_k.cpp b/src/modes/cmode_k.cpp index 6e5ba0269..751b993d3 100644 --- a/src/modes/cmode_k.cpp +++ b/src/modes/cmode_k.cpp @@ -39,9 +39,14 @@ ModeAction ModeChannelKey::OnModeChange(userrec* source, userrec* dest, chanrec* else if ((!channel->modes[CM_KEY]) || ((adding) && (!IS_LOCAL(source)))) { /* Key isnt currently set */ - strlcpy(channel->key,parameter.c_str(),32); - channel->modes[CM_KEY] = adding; - return MODEACTION_ALLOW; + if (parameter.length()) + { + strlcpy(channel->key,parameter.c_str(),32); + channel->modes[CM_KEY] = adding; + return MODEACTION_ALLOW; + } + else + return MODEACTION_DENY; } else if (((channel->modes[CM_KEY]) && (!strcasecmp(parameter.c_str(),channel->key))) || ((!adding) && (!IS_LOCAL(source)))) {