diff options
author | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2013-04-27 14:25:01 +0000 |
---|---|---|
committer | michael <michael@82007160-df01-0410-b94d-b575c5fd34c7> | 2013-04-27 14:25:01 +0000 |
commit | 899db75e2e80485613eb4377a9a861abcfa217a7 (patch) | |
tree | 48f93ea8cead86ffb7b601bd3723bc3a60197e28 /modules/core | |
parent | f6fa8d23a362cddf4e3dda6e085f48df47a9fe4b (diff) |
- m_quit(), ms_quit(): added extra sanity test for parv[1] being NULL,
also try to avoid modifying parv[1]
git-svn-id: svn://svn.ircd-hybrid.org/svnroot/ircd-hybrid/branches/8.1.x@1890 82007160-df01-0410-b94d-b575c5fd34c7
Diffstat (limited to 'modules/core')
-rw-r--r-- | modules/core/m_quit.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/modules/core/m_quit.c b/modules/core/m_quit.c index ca73e2e..d103729 100644 --- a/modules/core/m_quit.c +++ b/modules/core/m_quit.c @@ -42,13 +42,12 @@ static void m_quit(struct Client *client_p, struct Client *source_p, int parc, char *parv[]) { - char *comment = (parc > 1 && parv[1]) ? parv[1] : client_p->name; char reason[KICKLEN + 1] = "Quit: "; - if (*comment && (HasUMode(source_p, UMODE_OPER) || + if (!EmptyString(parv[1]) && (HasUMode(source_p, UMODE_OPER) || (source_p->localClient->firsttime + ConfigFileEntry.anti_spam_exit_message_time) < CurrentTime)) - strlcpy(reason+6, comment, sizeof(reason)-6); + strlcpy(reason + 6, parv[1], sizeof(reason) - 6); exit_client(source_p, source_p, reason); } @@ -62,12 +61,14 @@ static void ms_quit(struct Client *client_p, struct Client *source_p, int parc, char *parv[]) { - char *comment = (parc > 1 && parv[1]) ? parv[1] : client_p->name; + char reason[KICKLEN + 1] = { '\0' }; - if (strlen(comment) > (size_t)KICKLEN) - comment[KICKLEN] = '\0'; + if (!EmptyString(parv[1])) + strlcpy(reason, parv[1], sizeof(reason)); + else + strlcpy(reason, client_p->name, sizeof(reason)); - exit_client(source_p, source_p, comment); + exit_client(source_p, source_p, reason); } static struct Message quit_msgtab = { |