mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-09 20:24:16 +00:00
default-initialize message-id buffer to an invalid (but defined) state and trust the compiler to optimize it out
This commit is contained in:
@@ -1397,7 +1397,7 @@ void HandlePacket(Packet* packet) {
|
||||
|
||||
default:
|
||||
// Need to use memcpy instead of reinterpret_cast to avoid UB
|
||||
MessageType::World messageId;
|
||||
auto messageId = MessageType::World::INVALID;
|
||||
std::memcpy(&messageId, &packet->data[3], sizeof(MessageType::World));
|
||||
|
||||
const std::string_view messageIdString = StringifiedEnum::ToString(messageId);
|
||||
|
Reference in New Issue
Block a user