[8850] Check packet opcode for >= NUM_MSG_TYPES before queueing.

Also add check for wrong packet status requirement in code.
This commit is contained in:
XTZGZoReX 2009-11-20 20:11:39 +01:00
parent ab62a11d4e
commit 0011a41003
3 changed files with 86 additions and 83 deletions

View file

@ -169,14 +169,6 @@ bool WorldSession::Update(uint32 /*diff*/)
packet->GetOpcode());
#endif*/
if(packet->GetOpcode() >= NUM_MSG_TYPES)
{
sLog.outError( "SESSION: received non-existed opcode %s (0x%.4X)",
LookupOpcodeName(packet->GetOpcode()),
packet->GetOpcode());
}
else
{
OpcodeHandler& opHandle = opcodeTable[packet->GetOpcode()];
try
{
@ -249,6 +241,11 @@ bool WorldSession::Update(uint32 /*diff*/)
LookupOpcodeName(packet->GetOpcode()),
packet->GetOpcode());
break;
default:
sLog.outError("SESSION: received wrong-status-req opcode %s (0x%.4X)",
LookupOpcodeName(packet->GetOpcode()),
packet->GetOpcode());
break;
}
}
catch(ByteBufferException &)
@ -261,7 +258,6 @@ bool WorldSession::Update(uint32 /*diff*/)
packet->hexlike();
}
}
}
delete packet;
}

View file

@ -659,6 +659,13 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
const ACE_UINT16 opcode = new_pct->GetOpcode ();
if (opcode >= NUM_MSG_TYPES)
{
sLog.outError( "SESSION: received non-existed opcode %s (0x%.4X)",
LookupOpcodeName(opcode), opcode);
return -1;
}
if (closing_)
return -1;

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "8849"
#define REVISION_NR "8850"
#endif // __REVISION_NR_H__