]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix sending malformed pong messages in some cases.
authorSadie Powell <sadie@witchery.services>
Fri, 14 May 2021 12:56:32 +0000 (13:56 +0100)
committerSadie Powell <sadie@witchery.services>
Fri, 14 May 2021 12:56:32 +0000 (13:56 +0100)
include/clientprotocolmsg.h
src/coremods/core_user/core_user.cpp

index 53122cff9965ca9652f696230b521d9f2c38e5a9..144af9e44e1b2ccdc47a4fbc88d2bdf845df5e0d 100644 (file)
@@ -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);
        }
 };
index 2431215f3c288cbeb55c0a24771f5775c1025a99..622e82c75813f927f717445463a5478b8fefec58 100644 (file)
@@ -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;
        }