summary refs log tree commit diff
diff options
context:
space:
mode:
authorSebastian Köhler <sebkoehler@whoami.org.uk>2013-02-14 19:21:01 +0100
committerSebastian Köhler <sebkoehler@whoami.org.uk>2013-02-15 10:21:58 +0100
commit0e63fb3fa7ac4ca048e8c2b648d2be3fd0572311 (patch)
tree7952cf471e16b72252852d73da412bcbd7170252
parent3e723318961b452c851eda2bec2a322fc249bfce (diff)
downloadngircd-0e63fb3fa7ac4ca048e8c2b648d2be3fd0572311.tar.gz
ngircd-0e63fb3fa7ac4ca048e8c2b648d2be3fd0572311.zip
KICK: Fix denial of service bug
Test if the user that it is to be kicked is on the channel before user
channel modes are tested. Otherwise assert( cl2chan != NULL ); in
line 742 would fail and stop the service.
-rw-r--r--src/ngircd/channel.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/ngircd/channel.c b/src/ngircd/channel.c
index 4eab2726..45bf615c 100644
--- a/src/ngircd/channel.c
+++ b/src/ngircd/channel.c
@@ -326,6 +326,13 @@ Channel_Kick(CLIENT *Peer, CLIENT *Target, CLIENT *Origin, const char *Name,
 		}
 	}
 
+	/* Check that the client to be kicked is on the specified channel */
+	if (!Channel_IsMemberOf(chan, Target)) {
+		IRC_WriteStrClient(Origin, ERR_USERNOTINCHANNEL_MSG,
+				   Client_ID(Origin), Client_ID(Target), Name );
+		return;
+	}
+
 	if(Client_Type(Peer) == CLIENT_USER) {
 		/* Channel mode 'Q' and user mode 'q' on target: nobody but
 		 * IRC Operators and servers can kick the target user */
@@ -382,13 +389,6 @@ Channel_Kick(CLIENT *Peer, CLIENT *Target, CLIENT *Origin, const char *Name,
 		}
 	}
 
-	/* Check that the client to be kicked is on the specified channel */
-	if (!Channel_IsMemberOf(chan, Target)) {
-		IRC_WriteStrClient(Origin, ERR_USERNOTINCHANNEL_MSG,
-				   Client_ID(Origin), Client_ID(Target), Name );
-		return;
-	}
-
 	/* Kick Client from channel */
 	Remove_Client( REMOVE_KICK, chan, Target, Origin, Reason, true);
 } /* Channel_Kick */