From ecf7690813b936a1751281f4b4a5199aa1db02c8 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Sat, 18 May 2013 21:02:09 +0200 Subject: m_channames Fix iteration in ValidateChans() Spotted by @Adam- --- src/modules/m_channames.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/modules/m_channames.cpp b/src/modules/m_channames.cpp index e78171c4a..b5f5853e7 100644 --- a/src/modules/m_channames.cpp +++ b/src/modules/m_channames.cpp @@ -89,9 +89,17 @@ class ModuleChannelNames : public Module ServerInstance->SendGlobalMode(modes, ServerInstance->FakeClient); } const UserMembList* users = c->GetUsers(); - for(UserMembCIter j = users->begin(); j != users->end(); ++j) + for(UserMembCIter j = users->begin(); j != users->end(); ) + { if (IS_LOCAL(j->first)) - c->KickUser(ServerInstance->FakeClient, j->first, "Channel name no longer valid"); + { + // KickUser invalidates the iterator + UserMembCIter it = j++; + c->KickUser(ServerInstance->FakeClient, it->first, "Channel name no longer valid"); + } + else + ++j; + } } badchan = false; } -- cgit v1.2.3