]> jfr.im git - irc/quakenet/newserv.git/commitdiff
Fix allowed gline mask length, again.
authorGunnar Beutner <redacted>
Mon, 15 Jul 2013 19:18:29 +0000 (21:18 +0200)
committerGunnar Beutner <redacted>
Mon, 15 Jul 2013 19:18:29 +0000 (21:18 +0200)
--HG--
branch : shroudtrusts

glines/glines_formats.c

index 252ed2240443facf22910d1de22f02c06c86b9d9..b9fd93525da9f010616476561a419ef806ef8c9c 100644 (file)
@@ -86,12 +86,20 @@ gline *makegline(const char *mask) {
   }
 
   /* Make sure it's not too long */
-  if (strlen(mask) > NICKLEN + USERLEN + HOSTLEN + 2)
+  if (strlen(mask) > NICKLEN + USERLEN + HOSTLEN + 4) {
+    freegline(gl);
     return NULL;
+  }
 
   strncpy(dupmask, mask, sizeof(dupmask));
   canon_userhost(dupmask, &nick, &user, &host, "*");
 
+  /* Make sure it's not too long */
+  if (strlen(nick) + strlen(user) + strlen(host) > NICKLEN + USERLEN + HOSTLEN) {
+    freegline(gl);
+    return NULL;
+  }
+
   if (ipmask_parse(host, &gl->ip, &gl->bits))
     gl->flags |= GLINE_IPMASK;
   else