diff options
| author | Florian Westphal <fw@strlen.de> | 2008-01-07 11:42:00 +0000 |
|---|---|---|
| committer | Florian Westphal <fw@strlen.de> | 2008-01-07 11:42:00 +0000 |
| commit | 463c5cb7c5ea272035ea05524001dddbe43156cf (patch) | |
| tree | a95f31be2866cb8f8bf6ad212937c7298b2f68b1 /src | |
| parent | 7548aa089c73a12d2fac3430e8ebb976a9bab4e3 (diff) | |
| download | ngircd-463c5cb7c5ea272035ea05524001dddbe43156cf.tar.gz ngircd-463c5cb7c5ea272035ea05524001dddbe43156cf.zip | |
IRC_PART could reference invalid memory.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ngircd/irc-channel.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/ngircd/irc-channel.c b/src/ngircd/irc-channel.c index 03204d65..fcc6e4aa 100644 --- a/src/ngircd/irc-channel.c +++ b/src/ngircd/irc-channel.c @@ -14,7 +14,7 @@ #include "portab.h" -static char UNUSED id[] = "$Id: irc-channel.c,v 1.40 2007/07/31 18:56:14 alex Exp $"; +static char UNUSED id[] = "$Id: irc-channel.c,v 1.41 2008/01/07 11:42:00 fw Exp $"; #include "imp.h" #include <assert.h> @@ -269,8 +269,9 @@ IRC_PART( CLIENT *Client, REQUEST *Req ) assert( Client != NULL ); assert( Req != NULL ); - /* Falsche Anzahl Parameter? */ - if(( Req->argc > 2 )) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command ); + if (Req->argc < 1 || Req->argc > 2) + return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG, + Client_ID(Client), Req->command); /* Wer ist der Absender? */ if( Client_Type( Client ) == CLIENT_SERVER ) target = Client_Search( Req->prefix ); @@ -278,18 +279,11 @@ IRC_PART( CLIENT *Client, REQUEST *Req ) if( ! target ) return IRC_WriteStrClient( Client, ERR_NOSUCHNICK_MSG, Client_ID( Client ), Req->prefix ); /* Channel-Namen durchgehen */ - chan = strtok( Req->argv[0], "," ); - while( chan ) - { - if( ! Channel_Part( target, Client, chan, Req->argc > 1 ? Req->argv[1] : Client_ID( target ))) - { - /* naechsten Namen ermitteln */ - chan = strtok( NULL, "," ); - continue; - } + chan = strtok(Req->argv[0], ","); + while (chan) { + Channel_Part(target, Client, chan, Req->argc > 1 ? Req->argv[1] : Client_ID(target)); - /* naechsten Namen ermitteln */ - chan = strtok( NULL, "," ); + chan = strtok(NULL, ","); } return CONNECTED; } /* IRC_PART */ |