From 8f7cdd5b61112802973470e74a87da52ee064920 Mon Sep 17 00:00:00 2001 From: satmd Date: Sun, 1 Jun 2014 17:53:31 +0200 Subject: Fix harmless loop off-by-ones found by Moonlightning --- src/commands/cmd_stats.cpp | 2 +- src/modules/m_autoop.cpp | 2 +- src/modules/m_check.cpp | 2 +- src/modules/m_exemptchanops.cpp | 2 +- src/users.cpp | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/commands/cmd_stats.cpp b/src/commands/cmd_stats.cpp index 23143442a..9399b7bea 100644 --- a/src/commands/cmd_stats.cpp +++ b/src/commands/cmd_stats.cpp @@ -348,7 +348,7 @@ void CommandStats::DoStats(char statschar, User* user, string_list &results) tag->init(); std::string umodes; std::string cmodes; - for(char c='A'; c < 'z'; c++) + for(char c='A'; c <= 'z'; c++) { ModeHandler* mh = ServerInstance->Modes->FindMode(c, MODETYPE_USER); if (mh && mh->NeedsOper() && tag->AllowedUserModes[c - 'A']) diff --git a/src/modules/m_autoop.cpp b/src/modules/m_autoop.cpp index 07dca6929..0c0e8f579 100644 --- a/src/modules/m_autoop.cpp +++ b/src/modules/m_autoop.cpp @@ -38,7 +38,7 @@ class AutoOpList : public ListModeBase { if (mid.length() == 1) return ServerInstance->Modes->FindMode(mid[0], MODETYPE_CHANNEL); - for(char c='A'; c < 'z'; c++) + for(char c='A'; c <= 'z'; c++) { ModeHandler* mh = ServerInstance->Modes->FindMode(c, MODETYPE_CHANNEL); if (mh && mh->name == mid) diff --git a/src/modules/m_check.cpp b/src/modules/m_check.cpp index 07276445f..96b357f20 100644 --- a/src/modules/m_check.cpp +++ b/src/modules/m_check.cpp @@ -114,7 +114,7 @@ class CommandCheck : public Command { std::string umodes; std::string cmodes; - for(char c='A'; c < 'z'; c++) + for(char c='A'; c <= 'z'; c++) { ModeHandler* mh = ServerInstance->Modes->FindMode(c, MODETYPE_USER); if (mh && mh->NeedsOper() && loctarg->HasModePermission(c, MODETYPE_USER)) diff --git a/src/modules/m_exemptchanops.cpp b/src/modules/m_exemptchanops.cpp index 9fac8e7ad..8d6d65af2 100644 --- a/src/modules/m_exemptchanops.cpp +++ b/src/modules/m_exemptchanops.cpp @@ -68,7 +68,7 @@ class ExemptHandler : public HandlerBase3Modes->FindMode(mid[0], MODETYPE_CHANNEL); - for(char c='A'; c < 'z'; c++) + for(char c='A'; c <= 'z'; c++) { ModeHandler* mh = ServerInstance->Modes->FindMode(c, MODETYPE_CHANNEL); if (mh && mh->name == mid) diff --git a/src/users.cpp b/src/users.cpp index 573d4db90..91db5200a 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -637,7 +637,7 @@ void OperInfo::init() { this->AllowedUserModes.set(); } - else if (*c >= 'A' && *c < 'z') + else if (*c >= 'A' && *c <= 'z') { this->AllowedUserModes[*c - 'A'] = true; } @@ -650,7 +650,7 @@ void OperInfo::init() { this->AllowedChanModes.set(); } - else if (*c >= 'A' && *c < 'z') + else if (*c >= 'A' && *c <= 'z') { this->AllowedChanModes[*c - 'A'] = true; } -- cgit v1.2.3