From 7f0de14650cdfe520831e06cfba0c15e5e7d9e5d Mon Sep 17 00:00:00 2001 From: brain Date: Thu, 31 May 2007 17:43:23 +0000 Subject: Fix for issue discovered by satmd where it is possible to send an empty string via privmsg or notice to a user target, against the RFC standard. Remote servers don't like this much. Also fix: NOTICE generates OnUserNotice event, but checks against the I_OnUserMessage hook. Also also fix (!): Missing colons in "no text to send" message. BOTH of these also fixes have been around since like, 1.0 alpha 1, and nobody's noticed them! git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7192 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/cmd_privmsg.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/cmd_privmsg.cpp') diff --git a/src/cmd_privmsg.cpp b/src/cmd_privmsg.cpp index 71e121a52..f3295df07 100644 --- a/src/cmd_privmsg.cpp +++ b/src/cmd_privmsg.cpp @@ -27,7 +27,6 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user) { userrec *dest; chanrec *chan; - CUList except_list; user->idle_lastmsg = ServerInstance->Time(); @@ -88,9 +87,10 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user) } parameters[1] = temp.c_str(); + /* Check again, a module may have zapped the input string */ if (temp.empty()) { - user->WriteServ("412 %s No text to send", user->nick); + user->WriteServ("412 %s :No text to send", user->nick); return CMD_FAILURE; } @@ -124,6 +124,12 @@ CmdResult cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user) dest = ServerInstance->FindNick(parameters[0]); if (dest) { + if (!*parameters[1]) + { + user->WriteServ("412 %s :No text to send", user->nick); + return CMD_FAILURE; + } + if (IS_AWAY(dest)) { /* auto respond with aweh msg */ -- cgit v1.3.1-10-gc9f91