1
0

Protocols: Ignore garbage data at the end of PluginMessage packets.

Fixes #1692.
This commit is contained in:
Mattes D
2015-01-03 22:23:49 +01:00
parent 35a3a1b9f4
commit 06c2669cf6
2 changed files with 21 additions and 0 deletions

View File

@@ -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;
}