WTF null packets crash the server??

This commit is contained in:
Shoghi Cervantes 2014-02-08 23:29:42 +01:00
parent 7f0693e7e7
commit dfa28d9a9e
2 changed files with 5 additions and 14 deletions

View File

@ -64,11 +64,11 @@ class UDPSocket{
return @socket_recvfrom($this->sock, $buf, 65535, 0, $source, $port); return @socket_recvfrom($this->sock, $buf, 65535, 0, $source, $port);
} }
public function write($data, $dest = false, $port = false){ public function write($data, $dest, $port){
if($this->connected === false){ if($this->connected === false){
return false; return false;
} }
return @socket_sendto($this->sock, $data, strlen($data), 0, ($dest === false ? $this->server:$dest), ($port === false ? $this->port:$port)); return @socket_sendto($this->sock, $data, strlen($data), 0, $dest, $port);
} }
} }

View File

@ -111,8 +111,8 @@ class RakNetParser{
case RakNetInfo::DATA_PACKET_F: case RakNetInfo::DATA_PACKET_F:
$this->packet->seqNumber = $this->getLTriad(); $this->packet->seqNumber = $this->getLTriad();
$this->packet->data = array(); $this->packet->data = array();
while(!$this->feof()){ while(!$this->feof() and ($pk = $this->parseDataPacket()) instanceof RakNetDataPacket){
$this->packet->data[] = $this->parseDataPacket(); $this->packet->data[] = $pk;
} }
break; break;
case RakNetInfo::NACK: case RakNetInfo::NACK:
@ -179,16 +179,7 @@ class RakNetParser{
if($length <= 0 if($length <= 0
or $orderChannel >= 32 or $orderChannel >= 32
or ($hasSplit === true and $splitIndex >= $splitCount)){ or ($hasSplit === true and $splitIndex >= $splitCount)){
$data = new UnknownPacket(); return false;
$data->reliability = $reliability;
$data->hasSplit = $hasSplit;
$data->messageIndex = $messageIndex;
$data->orderIndex = $orderIndex;
$data->orderChannel = $orderChannel;
$data->splitCount = $splitCount;
$data->splitID = $splitID;
$data->splitIndex = $splitIndex;
$data->setBuffer($this->get($length));
}else{ }else{
$pid = $this->getByte(); $pid = $this->getByte();
if(isset(ProtocolInfo::$packets[$pid])){ if(isset(ProtocolInfo::$packets[$pid])){