mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 17:20:02 +00:00
ResourcePacksSessionHandler: Account for out-of-bounds chunk requests
This commit is contained in:
parent
b9cd96f6e0
commit
d6e61e3e00
@ -113,11 +113,19 @@ class ResourcePacksSessionHandler extends SessionHandler{
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$offset = $packet->chunkIndex * self::PACK_CHUNK_SIZE;
|
||||||
|
if($offset < 0 or $offset >= $pack->getPackSize()){
|
||||||
|
$this->player->close("", "disconnectionScreen.resourcePack", true);
|
||||||
|
$this->player->getServer()->getLogger()->debug("Got a resource pack chunk request with invalid start offset $offset, file size is " . $pack->getPackSize());
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$pk = new ResourcePackChunkDataPacket();
|
$pk = new ResourcePackChunkDataPacket();
|
||||||
$pk->packId = $pack->getPackId();
|
$pk->packId = $pack->getPackId();
|
||||||
$pk->chunkIndex = $packet->chunkIndex;
|
$pk->chunkIndex = $packet->chunkIndex;
|
||||||
$pk->data = $pack->getPackChunk(self::PACK_CHUNK_SIZE * $packet->chunkIndex, self::PACK_CHUNK_SIZE);
|
$pk->data = $pack->getPackChunk($offset, self::PACK_CHUNK_SIZE);
|
||||||
$pk->progress = self::PACK_CHUNK_SIZE * $packet->chunkIndex;
|
$pk->progress = $offset;
|
||||||
$this->session->sendDataPacket($pk);
|
$this->session->sendDataPacket($pk);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user