From: Sadie Powell Date: Fri, 14 May 2021 13:26:46 +0000 (+0100) Subject: Fix an off by one error in various bitsets. X-Git-Url: https://git.netwichtig.de/gitweb/?a=commitdiff_plain;h=c24a7435b8171db15c719af119e708bfd9b719bc;p=user%2Fhenk%2Fcode%2Finspircd.git Fix an off by one error in various bitsets. --- diff --git a/include/modules/who.h b/include/modules/who.h index 36aecbc03..d5fcba977 100644 --- a/include/modules/who.h +++ b/include/modules/who.h @@ -51,8 +51,10 @@ class Who::EventListener : public Events::ModuleEventListener class Who::Request { public: + typedef std::bitset CharState; + /** The flags for matching users to include. */ - std::bitset flags; + CharState flags; /** Whether we are matching using a wildcard or a flag. */ bool fuzzy_match; @@ -67,7 +69,7 @@ class Who::Request bool whox; /** The fields to include in the WHOX response. */ - std::bitset whox_fields; + CharState whox_fields; /** A user specified label for the WHOX response. */ std::string whox_querytype; diff --git a/src/coremods/core_who.cpp b/src/coremods/core_who.cpp index aa19efe97..b853ef4b1 100644 --- a/src/coremods/core_who.cpp +++ b/src/coremods/core_who.cpp @@ -80,7 +80,7 @@ struct WhoData : public Who::Request // If flags have been specified by the source. if (parameters.size() > 1) { - std::bitset* current_bitset = &flags; + CharState* current_bitset = &flags; for (std::string::const_iterator iter = parameters[1].begin(); iter != parameters[1].end(); ++iter) { unsigned char chr = static_cast(*iter); diff --git a/src/modules/m_anticaps.cpp b/src/modules/m_anticaps.cpp index 2c39dce98..8b6cd50f5 100644 --- a/src/modules/m_anticaps.cpp +++ b/src/modules/m_anticaps.cpp @@ -158,8 +158,8 @@ class ModuleAntiCaps : public Module { private: CheckExemption::EventProvider exemptionprov; - std::bitset uppercase; - std::bitset lowercase; + std::bitset uppercase; + std::bitset lowercase; AntiCapsMode mode; void CreateBan(Channel* channel, User* user, bool mute) diff --git a/src/modules/m_blockcaps.cpp b/src/modules/m_blockcaps.cpp index 3bf9c98d0..c79ff15f5 100644 --- a/src/modules/m_blockcaps.cpp +++ b/src/modules/m_blockcaps.cpp @@ -34,8 +34,8 @@ class ModuleBlockCAPS : public Module SimpleChannelModeHandler bc; unsigned int percent; unsigned int minlen; - std::bitset lowercase; - std::bitset uppercase; + std::bitset lowercase; + std::bitset uppercase; public: ModuleBlockCAPS() diff --git a/src/modules/m_chghost.cpp b/src/modules/m_chghost.cpp index d8f306699..45709fa44 100644 --- a/src/modules/m_chghost.cpp +++ b/src/modules/m_chghost.cpp @@ -30,7 +30,7 @@ class CommandChghost : public Command { public: - std::bitset hostmap; + std::bitset hostmap; CommandChghost(Module* Creator) : Command(Creator,"CHGHOST", 2) diff --git a/src/modules/m_hostchange.cpp b/src/modules/m_hostchange.cpp index 47c831d29..56ea337fd 100644 --- a/src/modules/m_hostchange.cpp +++ b/src/modules/m_hostchange.cpp @@ -106,7 +106,7 @@ typedef std::vector HostRules; class ModuleHostChange : public Module { private: - std::bitset hostmap; + std::bitset hostmap; HostRules hostrules; std::string CleanName(const std::string& name) diff --git a/src/modules/m_sethost.cpp b/src/modules/m_sethost.cpp index 98067b459..18c964d1b 100644 --- a/src/modules/m_sethost.cpp +++ b/src/modules/m_sethost.cpp @@ -30,7 +30,7 @@ class CommandSethost : public Command { public: - std::bitset hostmap; + std::bitset hostmap; CommandSethost(Module* Creator) : Command(Creator,"SETHOST", 1)