From 592f23e7053cb81b076057918c3459a3ba0f5317 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 18 Aug 2006 16:51:20 +0000 Subject: Dont allow an empty key (thanks stskeeps) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4957 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modes/cmode_k.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/modes/cmode_k.cpp') 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)))) { -- cgit v1.2.3