commit 9810da343c586fb89490847540d410ff03c7bdec from: Alexander Barton date: Fri Jan 17 19:08:57 2003 UTC - Non-memers of a channel could crash the server when trying to change its modes. (HEAD) commit - e8b99f4d3a86df0c475dc902386151ec1222e30a commit + 9810da343c586fb89490847540d410ff03c7bdec blob - e3cd6396c1b4c1d94f8454e392175d32fb7ccb82 blob + ccd46b29fd631b99bcbf9680a36414cb08fb08cc --- src/ngircd/irc-mode.c +++ src/ngircd/irc-mode.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-mode.c,v 1.24.2.3 2003/01/08 23:13:45 alex Exp $"; +static char UNUSED id[] = "$Id: irc-mode.c,v 1.24.2.4 2003/01/17 19:08:57 alex Exp $"; #include "imp.h" #include @@ -278,6 +278,10 @@ Channel_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Or /* 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 )