Throw an exception when we cannot determine the end of the message/packet
This commit is contained in:
parent
3b99c409e0
commit
7087fe9bbb
@ -145,7 +145,7 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
||||
/* STATIC */
|
||||
|
||||
/**
|
||||
* Site of the packet header
|
||||
* Size of the packet header
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
@ -303,12 +303,16 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
||||
}
|
||||
|
||||
// See if we have found the end of the packet, if not read more.
|
||||
if ($end === FALSE && ($read_ptr < $size)) {
|
||||
if ($end === FALSE) {
|
||||
if ($read_ptr < $size) {
|
||||
$message .= substr($readbuf,$buf_ptr);
|
||||
$buf_ptr = 0;
|
||||
|
||||
continue;
|
||||
|
||||
} else
|
||||
throw new InvalidPacketException(sprintf('Cannot determine END of message/packet: %s|%s',get_class($o),hex_dump($message)));
|
||||
|
||||
} else {
|
||||
$message .= substr($readbuf,$buf_ptr,$end-$buf_ptr);
|
||||
$buf_ptr = $end+3;
|
||||
|
Loading…
Reference in New Issue
Block a user