Forward port 2.10.11 /whois CPU limiter.
[ircu2.10.12-pk.git] / ircd / m_whois.c
index ed0213ad2ee8d7a18d099d1e8ce45f06f8d4f6df..81d42f41d7c883f873ec14f83666791e3dc14613 100644 (file)
@@ -345,6 +345,7 @@ int m_whois(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
   char*           p = 0;
   int             found = 0;
   int            total = 0;
+  int             wildscount = 0;
 
   if (parc < 2)
   {
@@ -401,7 +402,13 @@ int m_whois(struct Client* cptr, struct Client* sptr, int parc, char* parv[])
       }
     }
     else /* wilds */
-       found=do_wilds(sptr, nick, total, parc);
+    {
+      if (++wildscount > 3) {
+        send_reply(sptr, ERR_QUERYTOOLONG, parv[1]);
+        break;
+      }
+      found=do_wilds(sptr, nick, total, parc);
+    }
 
     if (!found)
       send_reply(sptr, ERR_NOSUCHNICK, nick);