mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 08:28:32 +01:00
Core/PacketIO: Fixed crash happening when someone sends too small packet that is processed directly in WorldSocket
This commit is contained in:
@@ -351,9 +351,20 @@ WorldSocket::ReadDataHandlerResult WorldSocket::ReadDataHandler()
|
||||
switch (opcode)
|
||||
{
|
||||
case CMSG_PING:
|
||||
{
|
||||
LogOpcodeText(opcode, sessionGuard);
|
||||
return HandlePing(packet) ? ReadDataHandlerResult::Ok : ReadDataHandlerResult::Error;
|
||||
try
|
||||
{
|
||||
return HandlePing(packet) ? ReadDataHandlerResult::Ok : ReadDataHandlerResult::Error;
|
||||
}
|
||||
catch (ByteBufferPositionException const&)
|
||||
{
|
||||
}
|
||||
TC_LOG_ERROR("network", "WorldSocket::ReadDataHandler(): client %s sent malformed CMSG_PING", GetRemoteIpAddress().to_string().c_str());
|
||||
return ReadDataHandlerResult::Error;
|
||||
}
|
||||
case CMSG_AUTH_SESSION:
|
||||
{
|
||||
LogOpcodeText(opcode, sessionGuard);
|
||||
if (_worldSession)
|
||||
{
|
||||
@@ -363,8 +374,17 @@ WorldSocket::ReadDataHandlerResult WorldSocket::ReadDataHandler()
|
||||
return ReadDataHandlerResult::Error;
|
||||
}
|
||||
|
||||
HandleAuthSession(packet);
|
||||
return ReadDataHandlerResult::WaitingForQuery;
|
||||
try
|
||||
{
|
||||
HandleAuthSession(packet);
|
||||
return ReadDataHandlerResult::WaitingForQuery;
|
||||
}
|
||||
catch (ByteBufferPositionException const&)
|
||||
{
|
||||
}
|
||||
TC_LOG_ERROR("network", "WorldSocket::ReadDataHandler(): client %s sent malformed CMSG_AUTH_SESSION", GetRemoteIpAddress().to_string().c_str());
|
||||
return ReadDataHandlerResult::Error;
|
||||
}
|
||||
case CMSG_KEEP_ALIVE:
|
||||
LogOpcodeText(opcode, sessionGuard);
|
||||
sScriptMgr->OnPacketReceive(_worldSession, packet);
|
||||
|
||||
Reference in New Issue
Block a user