From bf8f62c32d6c66e38c167e6ca0ac59d29db52326 Mon Sep 17 00:00:00 2001 From: Adam Date: Sun, 24 Aug 2014 16:39:04 -0400 Subject: Change Channel::GetModeList to return a copy of the mode list, not a pair of lower/upper bound iterators. Sometimes when iterating the list, like in cs_mode, we can modify the contents of it, which combined with mlock always agressively trying to readd modes to it can do bad things. --- modules/m_xmlrpc_main.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'modules/m_xmlrpc_main.cpp') diff --git a/modules/m_xmlrpc_main.cpp b/modules/m_xmlrpc_main.cpp index 1a496c65c..13645bc98 100644 --- a/modules/m_xmlrpc_main.cpp +++ b/modules/m_xmlrpc_main.cpp @@ -155,21 +155,21 @@ class MyXMLRPCEvent : public XMLRPCEvent { request.reply("bancount", stringify(c->HasMode("BAN"))); int count = 0; - std::pair its = c->GetModeList("BAN"); - for (; its.first != its.second; ++its.first) - request.reply("ban" + stringify(++count), iface->Sanitize(its.first->second)); + std::vector v = c->GetModeList("BAN"); + for (unsigned int i = 0; i < v.size(); ++i) + request.reply("ban" + stringify(++count), iface->Sanitize(v[i])); request.reply("exceptcount", stringify(c->HasMode("EXCEPT"))); count = 0; - its = c->GetModeList("EXCEPT"); - for (; its.first != its.second; ++its.first) - request.reply("except" + stringify(++count), iface->Sanitize(its.first->second)); + v = c->GetModeList("EXCEPT"); + for (unsigned int i = 0; i < v.size(); ++i) + request.reply("except" + stringify(++count), iface->Sanitize(v[i])); request.reply("invitecount", stringify(c->HasMode("INVITEOVERRIDE"))); count = 0; - its = c->GetModeList("INVITEOVERRIDE"); - for (; its.first != its.second; ++its.first) - request.reply("invite" + stringify(++count), iface->Sanitize(its.first->second)); + v = c->GetModeList("INVITEOVERRIDE"); + for (unsigned int i = 0; i < v.size(); ++i) + request.reply("invite" + stringify(++count), iface->Sanitize(v[i])); Anope::string users; for (Channel::ChanUserList::const_iterator it = c->users.begin(); it != c->users.end(); ++it) -- cgit