Avoid intepreting non-IP-based hostmasks as IP-based.
[ircu2.10.12-pk.git] / ircd / match.c
index 62b60acf00d6f7b0fbffef4862fd120e0a797e97..f2074f63b7f7b9304fbdb4a329961587a45c296b 100644 (file)
@@ -875,6 +875,13 @@ int check_if_ipmask(const char *mask)
   int has_digit = 0;
   const char *p;
 
+  /* Given the bug that inspired this test, this may seem like a hasty
+   * kludge.  It isn't: Wildcard characters should be matched from the
+   * start, as when the username is the "interesting" part of the ban.
+   * Likewise, we cannot simply reject masks interpreted as */0.
+   */
+  if (mask[0] == '.' || mask[0] == '/')
+    return 0;
   for (p = mask; *p; ++p)
     if (*p != '*' && *p != '?' && *p != '.' && *p != '/')
     {