From d413959e576db66e6d9cdc73bbc7f7bd4dc7bf09 Mon Sep 17 00:00:00 2001 From: Bram Matthys Date: Fri, 23 Jan 2026 08:42:41 +0100 Subject: [PATCH] Chanmode +l: when coming from an IRC client, reject <=0 instead of transforming. Reject it with an ERR_INVALIDMODEPARAM, just like we do for +k. I think the higher number transforming is fine, but this <=0 transformation is odd as it almost never is what the user actually intended. In S2S traffic we still transform, as rejecting there is more problematic, (causing a desync) and transforming it there is not a major issue, anyway. Reported by ProgVal in https://bugs.unrealircd.org/view.php?id=6602 --- src/modules/chanmodes/limit.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/modules/chanmodes/limit.c b/src/modules/chanmodes/limit.c index ab2855d1d..a322f841d 100644 --- a/src/modules/chanmodes/limit.c +++ b/src/modules/chanmodes/limit.c @@ -119,7 +119,14 @@ int cmode_limit_is_ok(Client *client, Channel *channel, char mode, const char *p } else if (type == EXCHK_PARAM) { - /* Actually any value is valid, we just morph it */ + /* When coming from an IRC client, we reject limit <=0 explicitly, as it makes no sense */ + if (atoi(param) <= 0) + { + sendnumeric(client, ERR_INVALIDMODEPARAM, + channel->name, 'l', param, "Channel limit (+l) needs to be a positive number"); + return EX_DENY; + } + /* Any other value is valid, we just morph it */ return EX_ALLOW; }