summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-05-18 21:02:09 +0200
committerattilamolnar <attilamolnar@hush.com>2013-05-18 21:02:09 +0200
commitecf7690813b936a1751281f4b4a5199aa1db02c8 (patch)
tree744eee4e5a74c3890e0d0f85b37e5e78daf15791
parent740539d620997cc47fe930db13f41d1c4a650299 (diff)
m_channames Fix iteration in ValidateChans()
Spotted by @Adam-
-rw-r--r--src/modules/m_channames.cpp12
1 files changed, 10 insertions, 2 deletions
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;
}