Fix bounds check (#1071)

Fix Chat Crash

Update CMakeVariables.txt

Add checks for all servers
This commit is contained in:
David Markowitz
2023-05-06 11:32:53 -07:00
committed by GitHub
parent 7949907517
commit 33c12f3bc5
4 changed files with 7 additions and 1 deletions

View File

@@ -203,6 +203,8 @@ void HandlePacket(Packet* packet) {
Game::logger->Log("ChatServer", "A server is connecting, awaiting user list.");
}
if (packet->length < 4) return; // Nothing left to process. Need 4 bytes to continue.
if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::CHAT_INTERNAL) {
switch (static_cast<eChatInternalMessageType>(packet->data[3])) {
case eChatInternalMessageType::PLAYER_ADDED_NOTIFICATION: