[srvx-commits] commit: Fix memory corruption when removing certain bans from a channel.
Brought to you by:
entrope
From: Michael P. <md...@tr...> - 2005-02-08 04:43:17
|
Revision: srvx--devo--1.3--patch-16 Archive: sr...@sr...--2005-srvx Creator: Michael Poole <md...@tr...> Date: Mon Feb 7 23:42:43 EST 2005 Standard-date: 2005-02-08 04:42:43 GMT Modified-files: ChangeLog src/proto-common.c New-patches: sr...@sr...--2005-srvx/srvx--devo--1.3--patch-16 Summary: Fix memory corruption when removing certain bans from a channel. Keywords: src/proto-common.c (mod_chanmode_apply): Make sure we get a pointer to the ban we want to deallocate BEFORE we remove it from the banlist. * added files {arch}/srvx/srvx--devo/srvx--devo--1.3/sr...@sr...--2005-srvx/patch-log/patch-16 * modified files --- orig/ChangeLog +++ mod/ChangeLog @@ -2,6 +2,20 @@ # arch-tag: aut...@sr...--2005-srvx/srvx--devo--1.3 # +2005-02-08 04:42:43 GMT Michael Poole <md...@tr...> patch-16 + + Summary: + Fix memory corruption when removing certain bans from a channel. + Revision: + srvx--devo--1.3--patch-16 + + src/proto-common.c (mod_chanmode_apply): Make sure we get a pointer to + the ban we want to deallocate BEFORE we remove it from the banlist. + + modified files: + ChangeLog src/proto-common.c + + 2005-02-05 13:03:21 GMT Michael Poole <md...@tr...> patch-15 Summary: --- orig/src/proto-common.c +++ mod/src/proto-common.c @@ -569,9 +569,10 @@ * to be more specific than an existing ban. */ for (jj=0; jj<channel->banlist.used; ++jj) { - if (match_ircglobs(change->args[ii].u.hostmask, channel->banlist.list[jj]->ban)) { - banList_remove(&channel->banlist, channel->banlist.list[jj]); - free(channel->banlist.list[jj]); + bn = channel->banlist.list[jj]; + if (match_ircglobs(change->args[ii].u.hostmask, bn->ban)) { + banList_remove(&channel->banlist, bn); + free(bn); jj--; } } @@ -586,10 +587,11 @@ break; case MODE_REMOVE|MODE_BAN: for (jj=0; jj<channel->banlist.used; ++jj) { - if (strcmp(channel->banlist.list[jj]->ban, change->args[ii].u.hostmask)) + bn = channel->banlist.list[jj]; + if (strcmp(bn->ban, change->args[ii].u.hostmask)) continue; - free(channel->banlist.list[jj]); - banList_remove(&channel->banlist, channel->banlist.list[jj]); + free(bn); + banList_remove(&channel->banlist, bn); break; } break; |