summaryrefslogtreecommitdiffstats
path: root/src/Protocol/Protocol18x.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2015-01-03 22:23:49 +0100
committerMattes D <github@xoft.cz>2015-01-03 22:24:15 +0100
commit06c2669cf6b03feb15990004087e882ac846b061 (patch)
treecee462d333d82d86104306da7a64e8cfc3345caf /src/Protocol/Protocol18x.cpp
parentcByteBuffer: Improved SingleThreadAccessChecker performance. (diff)
downloadcuberite-06c2669cf6b03feb15990004087e882ac846b061.tar
cuberite-06c2669cf6b03feb15990004087e882ac846b061.tar.gz
cuberite-06c2669cf6b03feb15990004087e882ac846b061.tar.bz2
cuberite-06c2669cf6b03feb15990004087e882ac846b061.tar.lz
cuberite-06c2669cf6b03feb15990004087e882ac846b061.tar.xz
cuberite-06c2669cf6b03feb15990004087e882ac846b061.tar.zst
cuberite-06c2669cf6b03feb15990004087e882ac846b061.zip
Diffstat (limited to '')
-rw-r--r--src/Protocol/Protocol18x.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Protocol/Protocol18x.cpp b/src/Protocol/Protocol18x.cpp
index 72827ac47..21b098735 100644
--- a/src/Protocol/Protocol18x.cpp
+++ b/src/Protocol/Protocol18x.cpp
@@ -2331,6 +2331,16 @@ void cProtocol180::HandlePacketPluginMessage(cByteBuffer & a_ByteBuffer)
if (Channel.substr(0, 3) == "MC|")
{
HandleVanillaPluginMessage(a_ByteBuffer, Channel);
+
+ // Skip any unread data (vanilla sometimes sends garbage at the end of a packet; #1692):
+ if (a_ByteBuffer.GetReadableSpace() > 1)
+ {
+ LOGD("Protocol 1.8: Skipping garbage data at the end of a vanilla PluginMessage packet, %u bytes",
+ a_ByteBuffer.GetReadableSpace() - 1
+ );
+ a_ByteBuffer.SkipRead(a_ByteBuffer.GetReadableSpace() - 1);
+ }
+
return;
}