summaryrefslogtreecommitdiff
path: root/src/modes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modes.cpp')
-rw-r--r--src/modes.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/modes.cpp b/src/modes.cpp
index 9481f570e..1238df17d 100644
--- a/src/modes.cpp
+++ b/src/modes.cpp
@@ -671,12 +671,12 @@ Entry::Entry(const Anope::string &m, const Anope::string &fh) : name(m), mask(fh
{
const Anope::string &cidr_ip = this->host.substr(0, sl),
&cidr_range = this->host.substr(sl + 1);
+
+ sockaddrs addr(cidr_ip);
+
try
{
- sockaddrs addr(cidr_ip);
- /* If we got here, cidr_ip is a valid ip */
-
- if (cidr_range.is_pos_number_only())
+ if (addr.valid() && cidr_range.is_pos_number_only())
{
this->cidr_len = convertTo<unsigned short>(cidr_range);
/* If we got here, cidr_len is a valid number.
@@ -689,7 +689,6 @@ Entry::Entry(const Anope::string &m, const Anope::string &fh) : name(m), mask(fh
Log(LOG_DEBUG) << "Ban " << this->mask << " has cidr " << this->cidr_len;
}
}
- catch (const SocketException &) { }
catch (const ConvertException &) { }
}
}