From f7e22cf3e341010902f462aa9d13b282a176eca7 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 21 Apr 2008 16:24:04 +0000 Subject: Patch to fix timedbans crash reported earlier today, thanks for the headsup wonderwal git-svn-id: http://svn.inspircd.org/repository/branches/1_1_stable@9562 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_timedbans.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/modules/m_timedbans.cpp') diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index daaf23898..27cc2b091 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -164,9 +164,11 @@ class ModuleTimedBans : public Module if (cr) { const char *setban[3]; + std::string mask = i->mask; + setban[0] = i->channel.c_str(); setban[1] = "-b"; - setban[2] = i->mask.c_str(); + setban[2] = mask.c_str(); // kludge alert! // ::SendMode expects a userrec* to send the numeric replies // back to, so we create it a fake user that isnt in the user @@ -186,6 +188,15 @@ class ModuleTimedBans : public Module Event rmode((char *)&n, NULL, "send_mode"); rmode.Send(ServerInstance); DELETE(temp); + + bool was_removed = true; + for (BanList::iterator j = cr->bans.begin(); j != cr->bans.end(); j++) + if (!strcasecmp(j->data, mask.c_str())) + was_removed = false; + + /* Fix for crash if user cycles before the ban expires */ + if (!was_removed) + TimedBanList.erase(i); } else { -- cgit v1.3.1-10-gc9f91