about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2012-01-06 17:24:55 +0100
committerAlexander Barton <alex@barton.de>2012-01-06 17:24:55 +0100
commit1fa2af5b3a95cad24c3e8b56ee7e57aa5084bfdb (patch)
treed69dbdf8472860d1a785491dcd993f9dda4e98f4
parent05cc9bf9b064c7048f6b197462a686c5a9100798 (diff)
downloadngircd-1fa2af5b3a95cad24c3e8b56ee7e57aa5084bfdb.tar.gz
ngircd-1fa2af5b3a95cad24c3e8b56ee7e57aa5084bfdb.zip
Fix handling of channel mode sequence with/without arguments
For example, don't generate wrong error messages when handling
"MODE #chan +IIIIItn *!aa@b *!bb@c *!cc@d *!dd@e *!ee@f".
-rw-r--r--src/ngircd/irc-mode.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/ngircd/irc-mode.c b/src/ngircd/irc-mode.c
index d8329b16..01f87621 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';
@@ -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