parse: ensure that aliases have a sufficient number of parameters before trying to process them

This commit is contained in:
William Pitcock 2016-03-17 23:12:43 -05:00
parent 4598135e44
commit 1ca8cd5276

View file

@ -146,6 +146,15 @@ parse(struct Client *client_p, char *pbuffer, char *bufend)
struct alias_entry *aptr = rb_dictionary_retrieve(alias_dict, msgbuf.cmd); struct alias_entry *aptr = rb_dictionary_retrieve(alias_dict, msgbuf.cmd);
if (aptr != NULL) if (aptr != NULL)
{ {
if (msgbuf.n_para < 2)
{
sendto_one(client_p, form_str(ERR_NEEDMOREPARAMS),
me.name,
EmptyString(client_p->name) ? "*" : client_p->name,
msgbuf.cmd);
return;
}
do_alias(aptr, client_p, reconstruct_parv(msgbuf.n_para - 1, msgbuf.para + 1)); do_alias(aptr, client_p, reconstruct_parv(msgbuf.n_para - 1, msgbuf.para + 1));
return; return;
} }