summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-09-28 22:27:23 +0200
committermadmaxoft <github@xoft.cz>2014-09-28 22:27:23 +0200
commit488c6159df656e81cc90415d9f9026b34f1f1158 (patch)
tree9941777d5459e182c4dca57cf4d3a4bb505199c0 /src
parentProtocol 1.8: Fixed possible crash on malformed packet. (diff)
downloadcuberite-488c6159df656e81cc90415d9f9026b34f1f1158.tar
cuberite-488c6159df656e81cc90415d9f9026b34f1f1158.tar.gz
cuberite-488c6159df656e81cc90415d9f9026b34f1f1158.tar.bz2
cuberite-488c6159df656e81cc90415d9f9026b34f1f1158.tar.lz
cuberite-488c6159df656e81cc90415d9f9026b34f1f1158.tar.xz
cuberite-488c6159df656e81cc90415d9f9026b34f1f1158.tar.zst
cuberite-488c6159df656e81cc90415d9f9026b34f1f1158.zip
Diffstat (limited to '')
-rw-r--r--src/Protocol/Protocol18x.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp
index 625a29b7a..3985f5224 100644
--- a/src/Protocol/Protocol18x.cpp
+++ b/src/Protocol/Protocol18x.cpp
@@ -989,6 +989,7 @@ void cProtocol180::SendPluginMessage(const AString & a_Channel, const AString &
cPacketizer Pkt(*this, 0x3f);
Pkt.WriteString(a_Channel);
+ Pkt.WriteVarInt((UInt32)a_Message.size());
Pkt.WriteBuf(a_Message.data(), a_Message.size());
}
@@ -2320,8 +2321,9 @@ void cProtocol180::HandlePacketPlayerPosLook(cByteBuffer & a_ByteBuffer)
void cProtocol180::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer)
{
HANDLE_READ(a_ByteBuffer, ReadVarUTF8String, AString, Channel);
+ HANDLE_READ(a_ByteBuffer, ReadVarInt, UInt32, DataLen);
AString Data;
- if (!a_ByteBuffer.ReadString(Data, a_ByteBuffer.GetReadableSpace() - 1))
+ if (!a_ByteBuffer.ReadString(Data, DataLen))
{
return;
}