summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsjaz <sjaz@5417fbe8-f217-4b02-8779-1006273d7864>2009-04-26 16:40:36 +0000
committersjaz <sjaz@5417fbe8-f217-4b02-8779-1006273d7864>2009-04-26 16:40:36 +0000
commit845b15ddd99d5b6fde905045595e9d70f7a1c6f2 (patch)
treeab0098ddf6872095aab8d187688fe06c89bf9dc4
parentb9d2e9c09209dc68d86b1729c57f378d013c177e (diff)
Fix segfault in /os chankill (Adam)
git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@2291 5417fbe8-f217-4b02-8779-1006273d7864
-rw-r--r--src/core/os_chankill.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/core/os_chankill.c b/src/core/os_chankill.c
index 1962c4e4f..1d00aa753 100644
--- a/src/core/os_chankill.c
+++ b/src/core/os_chankill.c
@@ -28,8 +28,8 @@ class CommandOSChanKill : public Command
char reason[BUFSIZE], realreason[BUFSIZE];
time_t expires;
char mask[USERMAX + HOSTMAX + 2];
- struct c_userlist *cu, *next;
- int last_param = 1;
+ struct c_userlist *cu, *cunext;
+ unsigned last_param = 1;
Channel *c;
channel = params[0].c_str();
@@ -53,12 +53,12 @@ class CommandOSChanKill : public Command
else if (expires > 0)
expires += time(NULL);
- if (params.size() < last_param)
+ if (params.size() <= last_param)
{
this->OnSyntaxError(u);
return MOD_CONT;
}
- snprintf(reason, sizeof(reason), "%s%s%s", params[last_param].c_str(), last_param == 1 ? " " : "", last_param == 1 ? params[2].c_str() : "");
+ snprintf(reason, sizeof(reason), "%s%s", params[last_param].c_str(), (params.size() > last_param + 1 ? params[last_param + 1].c_str() : ""));
if (*reason)
{
@@ -69,9 +69,9 @@ class CommandOSChanKill : public Command
if ((c = findchan(channel)))
{
- for (cu = c->users; cu; cu = next)
+ for (cu = c->users; cu; cu = cunext)
{
- next = cu->next;
+ cunext = cu->next;
if (is_oper(cu->user))
continue;
strncpy(mask, "*@", 3); /* Use *@" for the akill's, */