diff options
author | Adam <Adam@anope.org> | 2011-02-19 19:03:05 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-02-19 19:03:05 -0500 |
commit | f49a3e03c1561cc5e9996a1450881dae50982f98 (patch) | |
tree | 356a381670302dcad347de26b1626b8a83330851 | |
parent | 109d1744a077faf3de5a218fddfd9ae2bdd5d245 (diff) |
Fixed aborting because of invalid values given to mode +f on inspircd
-rw-r--r-- | modules/protocol/bahamut.cpp | 10 | ||||
-rw-r--r-- | modules/protocol/inspircd11.cpp | 10 | ||||
-rw-r--r-- | modules/protocol/inspircd12.cpp | 14 | ||||
-rw-r--r-- | modules/protocol/inspircd20.cpp | 14 |
4 files changed, 32 insertions, 16 deletions
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp index ecb493dba..a8cdef155 100644 --- a/modules/protocol/bahamut.cpp +++ b/modules/protocol/bahamut.cpp @@ -543,9 +543,13 @@ bool event_burst(const Anope::string &source, const std::vector<Anope::string> & bool ChannelModeFlood::IsValid(const Anope::string &value) const { - Anope::string rest; - if (!value.empty() && value[0] != ':' && convertTo<int>(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo<int>(rest.substr(1), rest, false) > 0 && rest.empty()) - return true; + try + { + Anope::string rest; + if (!value.empty() && value[0] != ':' && convertTo<int>(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo<int>(rest.substr(1), rest, false) > 0 && rest.empty()) + return true; + } + catch (const ConvertException &) { } return false; } diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp index b945370bf..6e6fed13c 100644 --- a/modules/protocol/inspircd11.cpp +++ b/modules/protocol/inspircd11.cpp @@ -865,9 +865,13 @@ bool event_endburst(const Anope::string &source, const std::vector<Anope::string bool ChannelModeFlood::IsValid(const Anope::string &value) const { - Anope::string rest; - if (!value.empty() && value[0] != ':' && convertTo<int>(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo<int>(rest.substr(1), rest, false) > 0 && rest.empty()) - return true; + try + { + Anope::string rest; + if (!value.empty() && value[0] != ':' && convertTo<int>(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo<int>(rest.substr(1), rest, false) > 0 && rest.empty()) + return true; + } + catch (const ConvertException &) { } return false; } diff --git a/modules/protocol/inspircd12.cpp b/modules/protocol/inspircd12.cpp index dbb69a3c1..835c7d014 100644 --- a/modules/protocol/inspircd12.cpp +++ b/modules/protocol/inspircd12.cpp @@ -694,11 +694,15 @@ class Inspircd12IRCdMessage : public InspircdIRCdMessage bool ChannelModeFlood::IsValid(const Anope::string &value) const { - Anope::string rest; - if (!value.empty() && value[0] != ':' && convertTo<int>(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo<int>(rest.substr(1), rest, false) > 0 && rest.empty()) - return true; - else - return false; + try + { + Anope::string rest; + if (!value.empty() && value[0] != ':' && convertTo<int>(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo<int>(rest.substr(1), rest, false) > 0 && rest.empty()) + return true; + } + catch (const CoreException &) { } + + return false; } class ProtoInspIRCd : public Module diff --git a/modules/protocol/inspircd20.cpp b/modules/protocol/inspircd20.cpp index 2307de9df..d5600d4f4 100644 --- a/modules/protocol/inspircd20.cpp +++ b/modules/protocol/inspircd20.cpp @@ -670,11 +670,15 @@ class Inspircd20IRCdMessage : public InspircdIRCdMessage bool ChannelModeFlood::IsValid(const Anope::string &value) const { - Anope::string rest; - if (!value.empty() && value[0] != ':' && convertTo<int>(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo<int>(rest.substr(1), rest, false) > 0 && rest.empty()) - return true; - else - return false; + try + { + Anope::string rest; + if (!value.empty() && value[0] != ':' && convertTo<int>(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo<int>(rest.substr(1), rest, false) > 0 && rest.empty()) + return true; + } + catch (const ConvertException &) { } + + return false; } class ProtoInspIRCd : public Module |