Check if the specified length is correct

This commit is contained in:
Shoghi Cervantes 2014-02-09 05:37:40 +01:00
parent 5c1550e116
commit 8739017002

View File

@ -182,6 +182,10 @@ class RakNetParser{
return false;
}else{
$pid = $this->getByte();
$buffer = $this->get($length - 1);
if(strlen($buffer) < ($length - 1)){
return false;
}
if(isset(ProtocolInfo::$packets[$pid])){
$data = new ProtocolInfo::$packets[$pid];
}else{
@ -196,7 +200,7 @@ class RakNetParser{
$data->splitCount = $splitCount;
$data->splitID = $splitID;
$data->splitIndex = $splitIndex;
$data->setBuffer($this->get($length - 1));
$data->setBuffer($buffer);
}
return $data;
}