Fix processing packets when we loop without reading
This commit is contained in:
@@ -175,7 +175,8 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
||||
$last = '';
|
||||
|
||||
while ($buf_ptr || (! feof($f) && ($readbuf=fread($f,self::BLOCKSIZE)))) {
|
||||
$read_ptr += strlen($readbuf);
|
||||
if (! $buf_ptr)
|
||||
$read_ptr += strlen($readbuf); // Could use ftell()
|
||||
|
||||
if (strlen($message) < self::PACKED_MSG_HEADER_LEN) {
|
||||
$addchars = self::PACKED_MSG_HEADER_LEN-strlen($message);
|
||||
@@ -207,7 +208,7 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
||||
}
|
||||
|
||||
if (($end=strpos($readbuf,"\x00\x02\x00",$buf_ptr)) === FALSE) {
|
||||
// In case our packet break is at the end of the buffer
|
||||
// Just in case our packet break is at the end of the buffer
|
||||
$last = substr($readbuf,-2);
|
||||
|
||||
if ((str_contains($last,"\x00")) && ($size-$read_ptr > 2)) {
|
||||
|
Reference in New Issue
Block a user