CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Branch tags: u2_10_11_04
Commit time: 2002-12-30 01:09:15 UTC

Modified files:
  Tag: u2_10_11_04
     ChangeLog ircd/channel.c

Log message:

Author: [EMAIL PROTECTED]
Log message:

Hi there,

This patch should fix two limit bugs in the current ircu2.10.11.04:

- Users can set mode -l repeatedly when no limit is set
- Users can set huge limits using negative argument (e.g. +l -1 is                
translated to +l 4294966296).

Note that as a side effect of fixing the second bug limits >=2^31 cannot
be set any more, although this doesn't seem to be much of a problem given
that ircu is limited to 2^30 clients anyway.  To avoid this side effect
requires checking manually that the first char of the unconverted string
isn't '-' instead..

Cheers,

splidge
QuakeNet person

---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.290.2.126.2.6 ircu2.10/ChangeLog:1.290.2.126.2.7
--- ircu2.10/ChangeLog:1.290.2.126.2.6  Sun Dec 29 17:01:49 2002
+++ ircu2.10/ChangeLog  Sun Dec 29 17:09:04 2002
@@ -1,3 +1,8 @@
+2002-12-28  David Mansell <[EMAIL PROTECTED]>
+ 
+       * ircd/channel.c (mode_parse_limit): don't allow -l when no limit is
+       set, don't allow -l with negative parameter (or unsigned >2^31).
+ 
 2002-12-29  volta <[EMAIL PROTECTED]>
         
        * ircd/whocmds.c: fixed a bug in the who reply for field 'l',
Index: ircu2.10/ircd/channel.c
diff -u ircu2.10/ircd/channel.c:1.73.2.11 ircu2.10/ircd/channel.c:1.73.2.11.2.1
--- ircu2.10/ircd/channel.c:1.73.2.11   Sat Dec 14 17:02:39 2002
+++ ircu2.10/ircd/channel.c     Sun Dec 29 17:09:05 2002
@@ -17,7 +17,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  *
- * $Id: channel.c,v 1.73.2.11 2002/12/15 01:02:39 isomer Exp $
+ * $Id: channel.c,v 1.73.2.11.2.1 2002/12/30 01:09:05 isomer Exp $
  */
 #include "config.h"
 
@@ -1940,6 +1940,9 @@
     t_limit = strtoul(state->parv[state->args_used++], 0, 10); /* grab arg */
     state->parc--;
     state->max_args--;
+    
+    if ((int)t_limit<0) /* don't permit a negative limit */
+      return;
 
     if (!(state->flags & MODE_PARSE_WIPEOUT) &&
        (!t_limit || t_limit == state->chptr->mode.limit))
@@ -1952,6 +1955,10 @@
     send_notoper(state);
     return;
   }
+
+  /* Can't remove a limit that's not there */
+  if (state->dir == MODE_DEL && !state->chptr->mode.limit)
+    return;
 
   if (state->done & DONE_LIMIT) /* allow limit to be set only once */
     return;
----------------------- End of diff -----------------------

Reply via email to