1
0

cProtocol172: Check return values.

Fixes CID 43489, CID 43490, CID 43491, CID 43493, CID 66410, CID 66411, CID 66416, CID 66417, CID 66418, CID 66419, CID 66420, CID 66421, CID 66422, CID 66423, CID 66424, CID 66425, CID 66429, CID 66430, CID 66431
This commit is contained in:
madmaxoft 2014-08-11 15:33:20 +02:00
parent ef513720fb
commit 0a52ed6eb9

View File

@ -48,7 +48,10 @@ Implements the 1.7.x protocol classes:
#define HANDLE_READ(ByteBuf, Proc, Type, Var) \
Type Var; \
ByteBuf.Proc(Var);
if (!ByteBuf.Proc(Var))\
{\
return;\
}
@ -1700,8 +1703,7 @@ bool cProtocol172::HandlePacket(cByteBuffer & a_ByteBuffer, UInt32 a_PacketType)
void cProtocol172::HandlePacketStatusPing(cByteBuffer & a_ByteBuffer)
{
Int64 Timestamp;
a_ByteBuffer.ReadBEInt64(Timestamp);
HANDLE_READ(a_ByteBuffer, ReadBEInt64, Int64, Timestamp);
cPacketizer Pkt(*this, 0x01); // Ping packet
Pkt.WriteInt64(Timestamp);
@ -2054,7 +2056,10 @@ void cProtocol172::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer)
HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Channel);
HANDLE_READ(a_ByteBuffer, ReadBEShort, short, Length);
AString Data;
a_ByteBuffer.ReadString(Data, Length);
if (!a_ByteBuffer.ReadString(Data, Length))
{
return;
}
m_Client->HandlePluginMessage(Channel, Data);
}