Fixed coverity issues in protocols.
Fixes CID 73099, CID 66411.
This commit is contained in:
parent
9e9459a367
commit
d4c3821eca
|
@ -1524,7 +1524,7 @@ void cProtocol172::AddReceivedData(const char * a_Data, size_t a_Size)
|
||||||
AString PacketData;
|
AString PacketData;
|
||||||
bb.ReadAll(PacketData);
|
bb.ReadAll(PacketData);
|
||||||
bb.ResetRead();
|
bb.ResetRead();
|
||||||
bb.ReadVarInt(PacketType);
|
bb.ReadVarInt(PacketType); // We have already read the packet type once, it will be there again.
|
||||||
ASSERT(PacketData.size() > 0); // We have written an extra NUL, so there had to be at least one byte read
|
ASSERT(PacketData.size() > 0); // We have written an extra NUL, so there had to be at least one byte read
|
||||||
PacketData.resize(PacketData.size() - 1);
|
PacketData.resize(PacketData.size() - 1);
|
||||||
AString PacketDataHex;
|
AString PacketDataHex;
|
||||||
|
@ -1753,7 +1753,10 @@ void cProtocol172::HandlePacketLoginEncryptionResponse(cByteBuffer & a_ByteBuffe
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
a_ByteBuffer.ReadBEShort(EncNonceLength);
|
if (!a_ByteBuffer.ReadBEShort(EncNonceLength))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
AString EncNonce;
|
AString EncNonce;
|
||||||
if (!a_ByteBuffer.ReadString(EncNonce, EncNonceLength))
|
if (!a_ByteBuffer.ReadString(EncNonce, EncNonceLength))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1723,7 +1723,11 @@ void cProtocol180::AddReceivedData(const char * a_Data, size_t a_Size)
|
||||||
{
|
{
|
||||||
// Decompress the data:
|
// Decompress the data:
|
||||||
AString CompressedData;
|
AString CompressedData;
|
||||||
m_ReceivedData.ReadString(CompressedData, CompressedSize);
|
if (!m_ReceivedData.ReadString(CompressedData, CompressedSize))
|
||||||
|
{
|
||||||
|
m_Client->Kick("Compression failure");
|
||||||
|
return;
|
||||||
|
}
|
||||||
InflateString(CompressedData.data(), CompressedSize, UncompressedData);
|
InflateString(CompressedData.data(), CompressedSize, UncompressedData);
|
||||||
PacketLen = UncompressedData.size();
|
PacketLen = UncompressedData.size();
|
||||||
}
|
}
|
||||||
|
@ -1765,7 +1769,7 @@ void cProtocol180::AddReceivedData(const char * a_Data, size_t a_Size)
|
||||||
AString PacketData;
|
AString PacketData;
|
||||||
bb.ReadAll(PacketData);
|
bb.ReadAll(PacketData);
|
||||||
bb.ResetRead();
|
bb.ResetRead();
|
||||||
bb.ReadVarInt(PacketType);
|
bb.ReadVarInt(PacketType); // We have already read the packet type once, it will be there again
|
||||||
ASSERT(PacketData.size() > 0); // We have written an extra NUL, so there had to be at least one byte read
|
ASSERT(PacketData.size() > 0); // We have written an extra NUL, so there had to be at least one byte read
|
||||||
PacketData.resize(PacketData.size() - 1);
|
PacketData.resize(PacketData.size() - 1);
|
||||||
AString PacketDataHex;
|
AString PacketDataHex;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user