diff options
author | Peter Powell <petpow@saberuk.com> | 2018-12-12 13:54:31 +0000 |
---|---|---|
committer | Peter Powell <petpow@saberuk.com> | 2018-12-12 14:43:55 +0000 |
commit | 654355c2d114a68639ac36238291ebfceec2537d (patch) | |
tree | 3339798bf3d774c006ddc4ee7f7aa3c89d782962 | |
parent | 51891f10f2a05e16e45651a669db6680a433bf9b (diff) |
Reject setting modes which are null or not registered.
-rw-r--r-- | include/users.h | 3 | ||||
-rw-r--r-- | src/channels.cpp | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/include/users.h b/include/users.h index 28b370725..ef19adb5d 100644 --- a/include/users.h +++ b/include/users.h @@ -932,5 +932,6 @@ inline bool User::IsModeSet(UserModeReference& moderef) const inline void User::SetMode(ModeHandler* mh, bool value) { - modes[mh->GetId()] = value; + if (mh && mh->GetId() != ModeParser::MODEID_MAX) + modes[mh->GetId()] = value; } diff --git a/src/channels.cpp b/src/channels.cpp index c9816db4b..e25500892 100644 --- a/src/channels.cpp +++ b/src/channels.cpp @@ -40,7 +40,8 @@ Channel::Channel(const std::string &cname, time_t ts) void Channel::SetMode(ModeHandler* mh, bool on) { - modes[mh->GetId()] = on; + if (mh && mh->GetId() != ModeParser::MODEID_MAX) + modes[mh->GetId()] = on; } void Channel::SetTopic(User* u, const std::string& ntopic, time_t topicts, const std::string* setter) |