diff options
author | Mattes D <github@xoft.cz> | 2015-01-03 22:23:49 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2015-01-03 22:24:15 +0100 |
commit | 06c2669cf6b03feb15990004087e882ac846b061 (patch) | |
tree | cee462d333d82d86104306da7a64e8cfc3345caf /src/Protocol/Protocol17x.cpp | |
parent | cByteBuffer: Improved SingleThreadAccessChecker performance. (diff) | |
download | cuberite-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/Protocol17x.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/Protocol/Protocol17x.cpp b/src/Protocol/Protocol17x.cpp index 34103ea5a..4e985355a 100644 --- a/src/Protocol/Protocol17x.cpp +++ b/src/Protocol/Protocol17x.cpp @@ -2242,6 +2242,7 @@ void cProtocol172::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, const { if (a_Channel == "MC|AdvCdm") { + size_t BeginningSpace = a_ByteBuffer.GetReadableSpace(); HANDLE_READ(a_ByteBuffer, ReadByte, Byte, Mode); switch (Mode) { @@ -2265,6 +2266,16 @@ void cProtocol172::HandleVanillaPluginMessage(cByteBuffer & a_ByteBuffer, const return; } } // switch (Mode) + + // Read the remainder of the packet (Vanilla sometimes sends bogus data at the end of the packet; #1692): + size_t BytesRead = BeginningSpace - a_ByteBuffer.GetReadableSpace(); + if (BytesRead < static_cast<size_t>(a_PayloadLength)) + { + LOGD("Protocol 1.7: Skipping garbage data at the end of a vanilla MC|AdvCdm packet, %u bytes", + a_PayloadLength - BytesRead + ); + a_ByteBuffer.SkipRead(a_PayloadLength - BytesRead); + } return; } else if (a_Channel == "MC|Brand") |