diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Server/WorldSocket.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index abcf446dd8d..15f311b5d10 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(); |