From f49a3e03c1561cc5e9996a1450881dae50982f98 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 19 Feb 2011 19:03:05 -0500 Subject: Fixed aborting because of invalid values given to mode +f on inspircd --- modules/protocol/bahamut.cpp | 10 +++++++--- modules/protocol/inspircd11.cpp | 10 +++++++--- modules/protocol/inspircd12.cpp | 14 +++++++++----- modules/protocol/inspircd20.cpp | 14 +++++++++----- 4 files changed, 32 insertions(+), 16 deletions(-) (limited to 'modules/protocol') 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 & bool ChannelModeFlood::IsValid(const Anope::string &value) const { - Anope::string rest; - if (!value.empty() && value[0] != ':' && convertTo(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo(rest.substr(1), rest, false) > 0 && rest.empty()) - return true; + try + { + Anope::string rest; + if (!value.empty() && value[0] != ':' && convertTo(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo(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(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo(rest.substr(1), rest, false) > 0 && rest.empty()) - return true; + try + { + Anope::string rest; + if (!value.empty() && value[0] != ':' && convertTo(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo(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(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo(rest.substr(1), rest, false) > 0 && rest.empty()) - return true; - else - return false; + try + { + Anope::string rest; + if (!value.empty() && value[0] != ':' && convertTo(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo(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(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo(rest.substr(1), rest, false) > 0 && rest.empty()) - return true; - else - return false; + try + { + Anope::string rest; + if (!value.empty() && value[0] != ':' && convertTo(value[0] == '*' ? value.substr(1) : value, rest, false) > 0 && rest[0] == ':' && rest.length() > 1 && convertTo(rest.substr(1), rest, false) > 0 && rest.empty()) + return true; + } + catch (const ConvertException &) { } + + return false; } class ProtoInspIRCd : public Module -- cgit