From 4350a11c663b0d75f8119743bffb7736d87abd4d Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 14 May 2021 13:56:32 +0100 Subject: Fix sending malformed pong messages in some cases. --- include/clientprotocolmsg.h | 7 ++++--- src/coremods/core_user/core_user.cpp | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/include/clientprotocolmsg.h b/include/clientprotocolmsg.h index 53122cff9..144af9e44 100644 --- a/include/clientprotocolmsg.h +++ b/include/clientprotocolmsg.h @@ -668,9 +668,10 @@ struct ClientProtocol::Messages::Pong : public ClientProtocol::Message Pong(const std::string& cookie, const std::string& server = "") : ClientProtocol::Message("PONG", ServerInstance->Config->GetServerName()) { - PushParamRef(ServerInstance->Config->GetServerName()); - if (!server.empty()) - PushParamRef(server); + if (server.empty()) + PushParamRef(ServerInstance->Config->GetServerName()); + else + PushParam(server); PushParamRef(cookie); } }; diff --git a/src/coremods/core_user/core_user.cpp b/src/coremods/core_user/core_user.cpp index 2431215f3..622e82c75 100644 --- a/src/coremods/core_user/core_user.cpp +++ b/src/coremods/core_user/core_user.cpp @@ -83,7 +83,7 @@ class CommandPing : public SplitCommand return CMD_FAILURE; } - ClientProtocol::Messages::Pong pong(parameters[0], origin ? parameters[1] : ""); + ClientProtocol::Messages::Pong pong(parameters[0], origin ? parameters[1] : ServerInstance->Config->GetServerName()); user->Send(ServerInstance->GetRFCEvents().pong, pong); return CMD_SUCCESS; } -- cgit v1.2.3