From 5851e7fe557646bf44cd8cc88f65a4e2eaed590c Mon Sep 17 00:00:00 2001 From: dktapps Date: Tue, 30 Aug 2016 13:26:15 +0100 Subject: [PATCH] Network: Do not attempt to decode further for non-accepted protocols Prevents 0.16 players crashing 0.15 servers --- src/pocketmine/network/protocol/LoginPacket.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pocketmine/network/protocol/LoginPacket.php b/src/pocketmine/network/protocol/LoginPacket.php index 4d1e347b1..284591d89 100644 --- a/src/pocketmine/network/protocol/LoginPacket.php +++ b/src/pocketmine/network/protocol/LoginPacket.php @@ -41,7 +41,11 @@ class LoginPacket extends DataPacket{ public function decode(){ $this->protocol = $this->getInt(); - $str = zlib_decode($this->get($this->getInt()), 1024 * 1024 * 64); //Max 64MB + if($this->protocol !== Info::CURRENT_PROTOCOL){ + return; //Do not attempt to decode for non-accepted protocols + } + $str = zlib_decode($this->get($this->getInt()), 1024 * 1024 * 64); + $this->setBuffer($str, 0); $chainData = json_decode($this->get($this->getLInt()));