refuse opers setting an invalidly long k-line reason

This commit is contained in:
Jess Porter 2022-06-30 23:59:17 +01:00 committed by GitHub
parent 3fdf26aa19
commit 5a3e99829a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)
{