Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/network/protocols/server_lobby.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,11 @@ bool ServerLobby::notifyEvent(Event* event)
void ServerLobby::handleChat(Event* event)
{
if (!checkDataSize(event, 1) || !ServerConfig::m_chat) return;
if (event->getPeer()->getPlayerProfiles().empty())
{
Log::warn("ServerLobby", "Ignoring chat from peer without a profile.");
return;
}

// Update so that the peer is not kicked
event->getPeer()->updateLastActivity();
Expand Down Expand Up @@ -2797,6 +2802,12 @@ void ServerLobby::handleUnencryptedConnection(std::shared_ptr<STKPeer> peer,
// if this is a pending connection
unsigned total_players = 0;
unsigned player_count = data.getUInt8();
if (player_count == 0)
{
Log::warn("ServerLobby", "Rejecting connection without a player profile.");
peer->reset();
return;
}

if (is_pending_connection)
{
Expand Down