X-Git-Url: https://jfr.im/git/solanum.git/blobdiff_plain/999c42bad813dd4d0d2009c053bd53301dc43bc8..f8838806ef332738fd17e725c9e7d5b1418a9756:/modules/m_alias.c diff --git a/modules/m_alias.c b/modules/m_alias.c index 3879a814..b8f1b035 100644 --- a/modules/m_alias.c +++ b/modules/m_alias.c @@ -31,6 +31,7 @@ #include "numeric.h" #include "send.h" #include "packet.h" +#include "s_assert.h" static const char alias_desc[] = "Provides the system for services aliases"; @@ -60,9 +61,12 @@ create_aliases(void) RB_DICTIONARY_FOREACH(alias, &iter, alias_dict) { - struct Message *message = rb_malloc(sizeof(struct Message)); + struct Message *message = rb_malloc(sizeof(*message) + strlen(alias->name) + 1); + char *cmd = (char*)message + sizeof(*message); - message->cmd = alias->name; + /* copy the alias name as it will be freed early on a rehash */ + strcpy(cmd, alias->name); + message->cmd = cmd; memcpy(message->handlers, alias_msgtab, sizeof(alias_msgtab)); mod_add_cmd(message); @@ -121,14 +125,6 @@ m_alias(struct MsgBuf *msgbuf, struct Client *client_p, struct Client *source_p, return; } - else if(parc < 2) - { - sendto_one(client_p, form_str(ERR_NEEDMOREPARAMS), - me.name, - EmptyString(client_p->name) ? "*" : client_p->name, - msgbuf->cmd); - return; - } if(!IsFloodDone(client_p) && client_p->localClient->receiveM > 20) flood_endgrace(client_p); @@ -155,6 +151,7 @@ m_alias(struct MsgBuf *msgbuf, struct Client *client_p, struct Client *source_p, return; } + msgbuf_reconstruct_tail(msgbuf, 1); if(EmptyString(parv[1])) { sendto_one(client_p, form_str(ERR_NOTEXTTOSEND), me.name, target_p->name);