+2012-05-31 Michael Poole <mdpoole@troilus.org>
+
+ * ircd/gline.c (gline_add): Add length checks for badchan and
+ realname G-lines, comparable to the existing check for traditional
+ G-lines.
+
+ * ircd/s_err.c (ERR_LONGMASK): Remove extra space in format string.
+
2012-05-31 Michael Poole <mdpoole@troilus.org>
* ircd/m_server.c (check_loop_and_lh): Mention the mechanism used
#include "config.h"
#include "gline.h"
+#include "channel.h"
#include "client.h"
#include "ircd.h"
#include "ircd_alloc.h"
if (*userhost == '#' || *userhost == '&') {
if ((flags & GLINE_LOCAL) && !HasPriv(sptr, PRIV_LOCAL_BADCHAN))
return send_reply(sptr, ERR_NOPRIVILEGES);
+ /* Allow maximum channel name length, plus margin for wildcards. */
+ if (strlen(userhost+1) >= CHANNELLEN + 6)
+ return send_reply(sptr, ERR_LONGMASK);
flags |= GLINE_BADCHAN;
user = userhost;
host = NULL;
} else if (*userhost == '$') {
switch (userhost[1]) {
- case 'R': flags |= GLINE_REALNAME; break;
+ case 'R':
+ /* Allow REALLEN for the real name, plus margin for wildcards. */
+ if (strlen(userhost+2) >= REALLEN + 6)
+ return send_reply(sptr, ERR_LONGMASK);
+ flags |= GLINE_REALNAME;
+ break;
default:
/* uh, what to do here? */
/* The answer, my dear Watson, is we throw a protocol_violation()
/* 517 */
{ ERR_DISABLED, "%s :Command disabled.", "517" },
/* 518 */
- { ERR_LONGMASK, " :Mask is too long", "518" },
+ { ERR_LONGMASK, ":Mask is too long", "518" },
/* 519 */
{ ERR_TOOMANYUSERS, "%d :Too many users affected by mask", "519" },
/* 520 */