]> jfr.im git - solanum.git/blobdiff - modules/m_kline.c
refuse opers setting an invalidly long k-line reason
[solanum.git] / modules / m_kline.c
index 2a3fc99dbf8c8a3ba541cab534250b6837cc15a2..b5d5acda5e9a67f1994673a8e9f91910acca3f99 100644 (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)
        {