From d0db99961f78a950d24cd23250a9438be29ed4ab Mon Sep 17 00:00:00 2001 From: Sovak Date: Sun, 12 Oct 2014 12:38:04 +0200 Subject: [PATCH] Core/PacketIO: Restored client opcode handler check lost in ace->boost transition --- src/server/game/Server/WorldSocket.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index abcf446dd8..15f311b5d1 100644 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -213,6 +213,17 @@ bool WorldSocket::ReadDataHandler() return false; } + // prevent invalid memory access/crash with custom opcodes + if (opcode >= NUM_OPCODE_HANDLERS) + return false; + + OpcodeHandler const* handler = opcodeTable[opcode]; + if (!handler || handler->Status == STATUS_UNHANDLED) + { + TC_LOG_ERROR("network.opcode", "No defined handler for opcode %s sent by %s", GetOpcodeNameForLogging(packet.GetOpcode()).c_str(), _worldSession->GetPlayerInfo().c_str()); + return false; + } + // Our Idle timer will reset on any non PING opcodes. // Catches people idling on the login screen and any lingering ingame connections. _worldSession->ResetTimeOutTime();