mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-25 15:07:28 +00:00
Fix bounds check (#1071)
Fix Chat Crash Update CMakeVariables.txt Add checks for all servers
This commit is contained in:
parent
7949907517
commit
33c12f3bc5
@ -171,6 +171,8 @@ dLogger* SetupLogger() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HandlePacket(Packet* packet) {
|
void HandlePacket(Packet* packet) {
|
||||||
|
if (packet->length < 4) return;
|
||||||
|
|
||||||
if (packet->data[0] == ID_USER_PACKET_ENUM) {
|
if (packet->data[0] == ID_USER_PACKET_ENUM) {
|
||||||
if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::SERVER) {
|
if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::SERVER) {
|
||||||
if (static_cast<eServerMessageType>(packet->data[3]) == eServerMessageType::VERSION_CONFIRM) {
|
if (static_cast<eServerMessageType>(packet->data[3]) == eServerMessageType::VERSION_CONFIRM) {
|
||||||
|
@ -203,6 +203,8 @@ void HandlePacket(Packet* packet) {
|
|||||||
Game::logger->Log("ChatServer", "A server is connecting, awaiting user list.");
|
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) {
|
if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::CHAT_INTERNAL) {
|
||||||
switch (static_cast<eChatInternalMessageType>(packet->data[3])) {
|
switch (static_cast<eChatInternalMessageType>(packet->data[3])) {
|
||||||
case eChatInternalMessageType::PLAYER_ADDED_NOTIFICATION:
|
case eChatInternalMessageType::PLAYER_ADDED_NOTIFICATION:
|
||||||
|
@ -495,6 +495,8 @@ void HandlePacket(Packet* packet) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (packet->length < 4) return;
|
||||||
|
|
||||||
if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::MASTER) {
|
if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::MASTER) {
|
||||||
switch (static_cast<eMasterMessageType>(packet->data[3])) {
|
switch (static_cast<eMasterMessageType>(packet->data[3])) {
|
||||||
case eMasterMessageType::REQUEST_PERSISTENT_ID: {
|
case eMasterMessageType::REQUEST_PERSISTENT_ID: {
|
||||||
|
@ -728,7 +728,7 @@ void HandlePacket(Packet* packet) {
|
|||||||
Game::server->SendToMaster(&bitStream);
|
Game::server->SendToMaster(&bitStream);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (packet->data[0] != ID_USER_PACKET_ENUM) return;
|
if (packet->data[0] != ID_USER_PACKET_ENUM || packet->length < 4) return;
|
||||||
if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::SERVER) {
|
if (static_cast<eConnectionType>(packet->data[1]) == eConnectionType::SERVER) {
|
||||||
if (static_cast<eServerMessageType>(packet->data[3]) == eServerMessageType::VERSION_CONFIRM) {
|
if (static_cast<eServerMessageType>(packet->data[3]) == eServerMessageType::VERSION_CONFIRM) {
|
||||||
AuthPackets::HandleHandshake(Game::server, packet);
|
AuthPackets::HandleHandshake(Game::server, packet);
|
||||||
|
Loading…
Reference in New Issue
Block a user