X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=src%2Fngircd%2Firc-mode.c;h=383c4dee288f5a96e3c0ae0b88855ac49e3d9fb7;hb=2f8877ded4f0831a2f6033c589fcd36d9cecd0ba;hp=d8329b1655e2a5f66b88277dd5a0274d86b09ab7;hpb=a71abfef4b82aace4989db6a4ed3c94d1266b287;p=ngircd-alex.git diff --git a/src/ngircd/irc-mode.c b/src/ngircd/irc-mode.c index d8329b16..383c4dee 100644 --- a/src/ngircd/irc-mode.c +++ b/src/ngircd/irc-mode.c @@ -1,6 +1,6 @@ /* * ngIRCd -- The Next Generation IRC Daemon - * Copyright (c)2001-2011 Alexander Barton (alex@barton.de) and Contributors. + * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -280,7 +280,7 @@ Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target ) /* Are there changed modes? */ if (the_modes[1]) { - /* Remoce needless action modifier characters */ + /* Remove needless action modifier characters */ len = strlen(the_modes) - 1; if (the_modes[len] == '+' || the_modes[len] == '-') the_modes[len] = '\0'; @@ -375,7 +375,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel) char the_modes[COMMAND_LEN], the_args[COMMAND_LEN], x[2], argadd[CLIENT_PASS_LEN], *mode_ptr; bool connected, set, skiponce, retval, onchannel, modeok, use_servermode; - int mode_arg, arg_arg; + int mode_arg, arg_arg, mode_arg_count = 0; CLIENT *client; long l; size_t len; @@ -428,6 +428,8 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel) mode_ptr++; if (!*mode_ptr) { /* Try next argument if there's any */ + if (arg_arg < 0) + break; if (arg_arg > mode_arg) mode_arg = arg_arg; else @@ -489,6 +491,8 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel) Client_ID(Origin), Channel_Name(Channel)); break; case 'k': /* Channel key */ + if (mode_arg_count++ >= MAX_HNDL_MODES_ARG) + goto chan_exit; if (!set) { if (modeok) x[0] = *mode_ptr; @@ -523,6 +527,8 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel) } break; case 'l': /* Member limit */ + if (mode_arg_count++ >= MAX_HNDL_MODES_ARG) + goto chan_exit; if (!set) { if (modeok) x[0] = *mode_ptr; @@ -633,6 +639,8 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel) /* --- Channel lists --- */ case 'I': /* Invite lists */ case 'b': /* Ban lists */ + if (mode_arg_count++ >= MAX_HNDL_MODES_ARG) + goto chan_exit; if (arg_arg > mode_arg) { /* modify list */ if (modeok) { @@ -665,9 +673,9 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel) set ? '+' : '-', *mode_ptr, Client_ID(Origin), Channel_Name(Channel)); connected = IRC_WriteStrClient(Origin, - ERR_UMODEUNKNOWNFLAG2_MSG, - Client_ID(Origin), - set ? '+' : '-', *mode_ptr); + ERR_UNKNOWNMODE_MSG, + Client_ID(Origin), *mode_ptr, + Channel_Name(Channel)); x[0] = '\0'; } else { Log(LOG_DEBUG,