about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2003-01-17 19:04:19 +0000
committerAlexander Barton <alex@barton.de>2003-01-17 19:04:19 +0000
commite07542a1ff0f33b35dbab854596f29011e1ccf63 (patch)
treedb5380ce567425bd4a2bae7c111779ab6c193a29 /src
parent155f26eee2d8a31699165b78deb81619e5ad70a9 (diff)
downloadngircd-e07542a1ff0f33b35dbab854596f29011e1ccf63.tar.gz
ngircd-e07542a1ff0f33b35dbab854596f29011e1ccf63.zip
- Non-members of a channel could crash the server when trying to change its modes. Fixed.
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/irc-mode.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/ngircd/irc-mode.c b/src/ngircd/irc-mode.c
index 40dfb732..ec8771e9 100644
--- a/src/ngircd/irc-mode.c
+++ b/src/ngircd/irc-mode.c
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: irc-mode.c,v 1.29 2003/01/08 23:00:12 alex Exp $";
+static char UNUSED id[] = "$Id: irc-mode.c,v 1.30 2003/01/17 19:04:19 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -279,6 +279,10 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel )
 	/* Is the user allowed to change modes? */
 	if( Client_Type( Client ) == CLIENT_USER )
 	{
+		/* Is the originating user on that channel? */
+		if( ! Channel_IsMemberOf( Channel, Origin )) return IRC_WriteStrClient( Origin, ERR_NOTONCHANNEL_MSG, Client_ID( Origin ), Channel_Name( Channel ));
+
+		/* Is he channel operator? */
 		if( strchr( Channel_UserModes( Channel, Origin ), 'o' )) modeok = TRUE;
 		else modeok = FALSE;
 		if( Conf_OperCanMode )