Skip to content

Commit

Permalink
Fix kick event handler to not truncate uhost. Fixes #598
Browse files Browse the repository at this point in the history
Found by: wilkowy
Patch by: michaelortmann
Fixes: #598
  • Loading branch information
michaelortmann authored and vanosg committed Oct 1, 2018
1 parent 39cbb0c commit 6338ef8
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/mod/irc.mod/chan.c
Expand Up @@ -2026,15 +2026,14 @@ static int gotpart(char *from, char *msg)
*/ */
static int gotkick(char *from, char *origmsg) static int gotkick(char *from, char *origmsg)
{ {
char *nick, *whodid, *chname, s1[UHOSTLEN], buf[UHOSTLEN], *uhost = buf; char *nick, *whodid, *chname, s1[UHOSTLEN], buf[UHOSTLEN], *uhost;
char buf2[511], *msg, *key; char buf2[511], *msg, *key;
memberlist *m; memberlist *m;
struct chanset_t *chan; struct chanset_t *chan;
struct userrec *u; struct userrec *u;
struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 }; struct flag_record fr = { FR_GLOBAL | FR_CHAN, 0, 0, 0, 0, 0 };


strncpy(buf2, origmsg, 510); strncpyz(buf2, origmsg, sizeof buf2);
buf2[510] = 0;
msg = buf2; msg = buf2;
chname = newsplit(&msg); chname = newsplit(&msg);
chan = findchan(chname); chan = findchan(chname);
Expand All @@ -2053,12 +2052,13 @@ static int gotkick(char *from, char *origmsg)
dprintf(DP_SERVER, "JOIN %s\n", dprintf(DP_SERVER, "JOIN %s\n",
chan->name[0] ? chan->name : chan->dname); chan->name[0] ? chan->name : chan->dname);
clear_channel(chan, CHAN_RESETALL); clear_channel(chan, CHAN_RESETALL);
return 0; /* rejoin if kicked before getting needed info <Wcc[08/08/02]> */ return 0; /* rejoin if kicked before getting needed info <Wcc[08/08/02]> */
} }
if (channel_active(chan)) { if (channel_active(chan)) {
fixcolon(msg); fixcolon(msg);
u = get_user_by_host(from); u = get_user_by_host(from);
strncpyz(uhost, from, sizeof uhost); strncpyz(buf, from, sizeof buf);
uhost = buf;
whodid = splitnick(&uhost); whodid = splitnick(&uhost);
detect_chan_flood(whodid, uhost, from, chan, FLOOD_KICK, nick); detect_chan_flood(whodid, uhost, from, chan, FLOOD_KICK, nick);


Expand Down

0 comments on commit 6338ef8

Please sign in to comment.