From c299adb31a9866a50eff7779c7ba513095a79feb Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 15 Jan 2020 12:09:05 +0000 Subject: Prevent users from sending an empty TAGMSG. --- src/modules/m_ircv3_ctctags.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/modules/m_ircv3_ctctags.cpp b/src/modules/m_ircv3_ctctags.cpp index 06896c905..e22c1f125 100644 --- a/src/modules/m_ircv3_ctctags.cpp +++ b/src/modules/m_ircv3_ctctags.cpp @@ -41,6 +41,13 @@ class CommandTagMsg : public Command return false; } + // Check whether a module zapped the message tags. + if (msgdetails.tags_out.empty()) + { + source->WriteNumeric(ERR_NOTEXTTOSEND, "No tags to send"); + return false; + } + // Inform modules that a TAGMSG is about to be sent. FOREACH_MOD_CUSTOM(tagevprov, CTCTags::EventListener, OnUserTagMessage, (source, msgtarget, msgdetails)); return true; @@ -209,6 +216,13 @@ class CommandTagMsg : public Command if (CommandParser::LoopCall(user, this, parameters, 0)) return CMD_SUCCESS; + // The specified message tags were empty. + if (parameters.GetTags().empty()) + { + user->WriteNumeric(ERR_NOTEXTTOSEND, "No tags to send"); + return CMD_FAILURE; + } + // Check that the source has the message tags capability. if (IS_LOCAL(user) && !cap.get(user)) return CMD_FAILURE; -- cgit v1.2.3