mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-20 16:00:20 +00:00
Merge pull request from GHSA-c6fg-99pr-25m9
This commit is contained in:
parent
3ed57ce49a
commit
6492cac5c1
@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
namespace pocketmine\entity;
|
||||
|
||||
use Ahc\Json\Comment as CommentedJsonDecoder;
|
||||
use pocketmine\utils\Limits;
|
||||
use function implode;
|
||||
use function in_array;
|
||||
use function json_encode;
|
||||
@ -48,7 +49,17 @@ final class Skin{
|
||||
/** @var string */
|
||||
private $geometryData;
|
||||
|
||||
private static function checkLength(string $string, string $name, int $maxLength) : void{
|
||||
if(strlen($string) > $maxLength){
|
||||
throw new InvalidSkinException("$name must be at most $maxLength bytes, but have " . strlen($string) . " bytes");
|
||||
}
|
||||
}
|
||||
|
||||
public function __construct(string $skinId, string $skinData, string $capeData = "", string $geometryName = "", string $geometryData = ""){
|
||||
self::checkLength($skinId, "Skin ID", Limits::INT16_MAX);
|
||||
self::checkLength($geometryName, "Geometry name", Limits::INT16_MAX);
|
||||
self::checkLength($geometryData, "Geometry data", Limits::INT32_MAX);
|
||||
|
||||
if($skinId === ""){
|
||||
throw new InvalidSkinException("Skin ID must not be empty");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user