Skip to content

Commit

Permalink
Fix sending malformed pong messages in some cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
SadieCat committed May 14, 2021
1 parent 1288e9e commit 4350a11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions include/clientprotocolmsg.h
Expand Up @@ -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);
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/coremods/core_user/core_user.cpp
Expand Up @@ -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;
}
Expand Down

0 comments on commit 4350a11

Please sign in to comment.