Merge pull request #338 from edk0/kline-zero

m_kline: insert a safety zero early
This commit is contained in:
Aaron Jones 2020-06-25 11:49:40 +00:00 committed by GitHub
commit 17698ba0d1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -99,7 +99,7 @@ mo_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
{ {
char def[] = "No Reason"; char def[] = "No Reason";
char user[USERLEN + 2]; char user[USERLEN + 2];
char host[HOSTLEN + 2]; char host_buf[HOSTLEN + 3], *host = host_buf + 1;
char *reason = def; char *reason = def;
char *oper_reason; char *oper_reason;
const char *target_server = NULL; const char *target_server = NULL;
@ -123,6 +123,12 @@ mo_kline(struct MsgBuf *msgbuf_p, struct Client *client_p, struct Client *source
if(find_user_host(source_p, parv[loc], user, host) == 0) if(find_user_host(source_p, parv[loc], user, host) == 0)
return; return;
if (*host == ':')
{
host--;
*host = '0';
}
loc++; loc++;
if(parc >= loc + 2 && !irccmp(parv[loc], "ON")) if(parc >= loc + 2 && !irccmp(parv[loc], "ON"))