From 5a3e99829addc0686ce9ddf372a3dc9d28b44269 Mon Sep 17 00:00:00 2001 From: Jess Porter Date: Thu, 30 Jun 2022 23:59:17 +0100 Subject: [PATCH] refuse opers setting an invalidly long k-line reason --- modules/m_kline.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/m_kline.c b/modules/m_kline.c index 2a3fc99d..b5d5acda 100644 --- a/modules/m_kline.c +++ b/modules/m_kline.c @@ -165,6 +165,11 @@ mo_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source } reason = LOCAL_COPY(parv[loc]); + if(strlen(reason) > BANREASONLEN) + { + sendto_one_notice(source_p, ":K-Line reason exceeds %d characters", BANREASONLEN); + return; + } if(parse_netmask_strict(host, NULL, NULL) == HM_ERROR) { @@ -234,9 +239,6 @@ mo_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source aconf->port = 0; aconf->info.oper = operhash_add(get_oper_name(source_p)); - if(strlen(reason) > BANREASONLEN) - reason[BANREASONLEN] = '\0'; - /* Look for an oper reason */ if((oper_reason = strchr(reason, '|')) != NULL) {