Skip to content

Commit

Permalink
Network: Add back error handling from old code for packet header in m…
Browse files Browse the repository at this point in the history
…angosd
  • Loading branch information
killerwife committed Feb 18, 2024
1 parent ac1053e commit d934cb6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/game/Server/WorldSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,12 @@ bool WorldSocket::ProcessIncomingData()
EndianConvertReverse(header->size);
EndianConvert(header->cmd);

if ((header->size < 4) || (header->size > 0x2800) || (header->cmd >= NUM_MSG_TYPES))
{
sLog.outError("WorldSocket::ProcessIncomingData: client sent malformed packet size = %u , cmd = %u", header->size, header->cmd);
return;
}

const Opcodes opcode = static_cast<Opcodes>(header->cmd);

size_t packetSize = header->size - 4;
Expand Down

1 comment on commit d934cb6

@killerwife
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.