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
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);