Limit mode parameter count.
authorZoot <zoot@gamesnet.net>
Sun, 29 Feb 2004 08:07:37 +0000 (08:07 +0000)
committerZoot <zoot@gamesnet.net>
Sun, 29 Feb 2004 08:07:37 +0000 (08:07 +0000)
Restrict the number of mode parameters sent by the P10 protocol
backend to MAXMODEPARAMS.
git-archimport-id: srvx@srvx.net--2004-srvx/srvx--devo--1.3--patch-14

src/proto-p10.c

index 5aabfc5b865f2bffeeba735ab0178547be7dec77..b96e115f816e84cfa01fdf5db7adb433bd82b531 100644 (file)
@@ -2087,7 +2087,8 @@ static void
 mod_chanmode_append(struct chanmode_buffer *buf, char ch, const char *arg)
 {
     size_t arg_len = strlen(arg);
-    if (buf->modes_used + buf->args_used + buf->chname_len + arg_len > 450) {
+    if (buf->modes_used > (MAXMODEPARAMS) ||
+        buf->modes_used + buf->args_used + buf->chname_len + arg_len > 450) {
         memcpy(buf->modes + buf->modes_used, buf->args, buf->args_used);
         buf->modes[buf->modes_used + buf->args_used] = '\0';
         irc_mode((buf->is_chanop ? buf->actor : NULL), buf->channel, buf->modes);