mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
Sign: apply a very stupid limit on text size
this is necessary because of the epidemic of server attacks going around lately.
This commit is contained in:
parent
4c268acc00
commit
389e7767d1
@ -36,6 +36,7 @@ use function implode;
|
||||
use function mb_check_encoding;
|
||||
use function mb_scrub;
|
||||
use function sprintf;
|
||||
use function strlen;
|
||||
|
||||
class Sign extends Spawnable{
|
||||
public const TAG_TEXT_BLOB = "Text";
|
||||
@ -151,6 +152,14 @@ class Sign extends Spawnable{
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
$size = 0;
|
||||
foreach($lines as $line){
|
||||
$size += strlen($line);
|
||||
}
|
||||
if($size > 1000){
|
||||
//trigger kick + IP ban - TODO: on 4.0 this will require a better fix
|
||||
throw new \UnexpectedValueException($player->getName() . " tried to write $size bytes of text onto a sign (bigger than max 1000)");
|
||||
}
|
||||
|
||||
$removeFormat = $player->getRemoveFormat();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user