Make sure packets are valid
Fixes CID 66408, 66409 and 72045
This commit is contained in:
parent
1e60265a90
commit
de30a8c8c6
@ -979,9 +979,18 @@ bool cProtocolRecognizer::TryRecognizeLengthedProtocol(UInt32 a_PacketLengthRema
|
|||||||
AString ServerAddress;
|
AString ServerAddress;
|
||||||
short ServerPort;
|
short ServerPort;
|
||||||
UInt32 NextState;
|
UInt32 NextState;
|
||||||
m_Buffer.ReadVarUTF8String(ServerAddress);
|
if (!m_Buffer.ReadVarUTF8String(ServerAddress))
|
||||||
m_Buffer.ReadBEShort(ServerPort);
|
{
|
||||||
m_Buffer.ReadVarInt(NextState);
|
break;
|
||||||
|
}
|
||||||
|
if (!m_Buffer.ReadBEShort(ServerPort))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!m_Buffer.ReadVarInt(NextState))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
m_Buffer.CommitRead();
|
m_Buffer.CommitRead();
|
||||||
m_Protocol = new cProtocol172(m_Client, ServerAddress, (UInt16)ServerPort, NextState);
|
m_Protocol = new cProtocol172(m_Client, ServerAddress, (UInt16)ServerPort, NextState);
|
||||||
return true;
|
return true;
|
||||||
@ -991,9 +1000,18 @@ bool cProtocolRecognizer::TryRecognizeLengthedProtocol(UInt32 a_PacketLengthRema
|
|||||||
AString ServerAddress;
|
AString ServerAddress;
|
||||||
short ServerPort;
|
short ServerPort;
|
||||||
UInt32 NextState;
|
UInt32 NextState;
|
||||||
m_Buffer.ReadVarUTF8String(ServerAddress);
|
if (!m_Buffer.ReadVarUTF8String(ServerAddress))
|
||||||
m_Buffer.ReadBEShort(ServerPort);
|
{
|
||||||
m_Buffer.ReadVarInt(NextState);
|
break;
|
||||||
|
}
|
||||||
|
if (!m_Buffer.ReadBEShort(ServerPort))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!m_Buffer.ReadVarInt(NextState))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
m_Buffer.CommitRead();
|
m_Buffer.CommitRead();
|
||||||
m_Protocol = new cProtocol176(m_Client, ServerAddress, (UInt16)ServerPort, NextState);
|
m_Protocol = new cProtocol176(m_Client, ServerAddress, (UInt16)ServerPort, NextState);
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user