diff options
author | Sadie Powell <sadie@witchery.services> | 2024-05-18 16:35:14 +0100 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2024-05-18 16:35:35 +0100 |
commit | 18e9e12261fa97aa47daf7d0fb729afd366aa5d6 (patch) | |
tree | 4a7721e24e88eb2034c5bfb7831c6407388b9f40 | |
parent | 9d68b29c9e0d8d31cbe2327daa2889d092cda492 (diff) |
Fix an iterator invalidation issue in cs_set and ns_set.
-rw-r--r-- | modules/chanserv/cs_set.cpp | 2 | ||||
-rw-r--r-- | modules/nickserv/ns_set.cpp | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/modules/chanserv/cs_set.cpp b/modules/chanserv/cs_set.cpp index c7952baba..932d1f43c 100644 --- a/modules/chanserv/cs_set.cpp +++ b/modules/chanserv/cs_set.cpp @@ -1146,7 +1146,7 @@ public: if (c->ci && keep_modes.HasExt(c->ci)) { Channel::ModeList ml = c->ci->last_modes; - for (const auto &[last_mode, last_value] : c->ci->last_modes) + for (const auto &[last_mode, last_value] : ml) c->SetMode(c->ci->WhoSends(), last_mode, last_value); } } diff --git a/modules/nickserv/ns_set.cpp b/modules/nickserv/ns_set.cpp index 88d8d97dd..6467ed311 100644 --- a/modules/nickserv/ns_set.cpp +++ b/modules/nickserv/ns_set.cpp @@ -1354,7 +1354,8 @@ public: { if (keep_modes.HasExt(u->Account())) { - for (const auto &[last_mode, last_value] : u->Account()->last_modes) + User::ModeList modes = u->Account()->last_modes; + for (const auto &[last_mode, last_value] : modes) { UserMode *um = ModeManager::FindUserModeByName(last_mode); /* if the null user can set the mode, then it's probably safe */ |