summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHowaner <franzi.moos@googlemail.com>2014-09-12 13:01:23 +0200
committerHowaner <franzi.moos@googlemail.com>2014-09-12 13:01:23 +0200
commit0d34fc9f31f6b4eabcc52236b7c2c0f6b9139041 (patch)
treec40931bc0e82483053ef5ec9efafbcb6f06032b6
parent1.8: Fixed ReadItem() (diff)
downloadcuberite-0d34fc9f31f6b4eabcc52236b7c2c0f6b9139041.tar
cuberite-0d34fc9f31f6b4eabcc52236b7c2c0f6b9139041.tar.gz
cuberite-0d34fc9f31f6b4eabcc52236b7c2c0f6b9139041.tar.bz2
cuberite-0d34fc9f31f6b4eabcc52236b7c2c0f6b9139041.tar.lz
cuberite-0d34fc9f31f6b4eabcc52236b7c2c0f6b9139041.tar.xz
cuberite-0d34fc9f31f6b4eabcc52236b7c2c0f6b9139041.tar.zst
cuberite-0d34fc9f31f6b4eabcc52236b7c2c0f6b9139041.zip
Diffstat (limited to '')
-rw-r--r--src/Protocol/Protocol18x.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp
index 9553dec1a..735700dda 100644
--- a/src/Protocol/Protocol18x.cpp
+++ b/src/Protocol/Protocol18x.cpp
@@ -1753,7 +1753,7 @@ void cProtocol180::AddReceivedData(const char * a_Data, size_t a_Size)
m_ReceivedData.ResetRead();
break;
}
- cByteBuffer bb(PacketLen + 1);
+ cByteBuffer bb(PacketLen);
VERIFY(m_ReceivedData.ReadToByteBuffer(bb, (int)PacketLen));
m_ReceivedData.CommitRead();
@@ -1819,7 +1819,7 @@ void cProtocol180::AddReceivedData(const char * a_Data, size_t a_Size)
return;
}
- if (bb.GetReadableSpace() != 1)
+ if (bb.GetReadableSpace() != 0)
{
// Read more or less than packet length, report as error
LOGWARNING("Protocol 1.8: Wrong number of bytes read for packet 0x%x, state %d. Read " SIZE_T_FMT " bytes, packet contained %u bytes",
@@ -2334,10 +2334,7 @@ void cProtocol180::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer)
{
HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Channel);
AString Data;
- if (!a_ByteBuffer.ReadString(Data, a_ByteBuffer.GetReadableSpace() - 1))
- {
- return;
- }
+ a_ByteBuffer.ReadAll(Data);
m_Client->HandlePluginMessage(Channel, Data);
}
@@ -2594,10 +2591,7 @@ bool cProtocol180::ReadItem(cByteBuffer & a_ByteBuffer, cItem & a_Item)
// Read the metadata
AString Metadata;
- if (a_ByteBuffer.ReadString(Metadata, a_ByteBuffer.GetReadableSpace() - 1))
- {
- return false;
- }
+ a_ByteBuffer.ReadAll(Metadata);
ParseItemMetadata(a_Item, Metadata);
return true;