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 */
|
/* STATIC */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Site of the packet header
|
* Size of the packet header
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
@ -303,11 +303,15 @@ class Packet extends FTNBase implements \Iterator, \Countable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// See if we have found the end of the packet, if not read more.
|
// See if we have found the end of the packet, if not read more.
|
||||||
if ($end === FALSE && ($read_ptr < $size)) {
|
if ($end === FALSE) {
|
||||||
$message .= substr($readbuf,$buf_ptr);
|
if ($read_ptr < $size) {
|
||||||
$buf_ptr = 0;
|
$message .= substr($readbuf,$buf_ptr);
|
||||||
|
$buf_ptr = 0;
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
} else
|
||||||
|
throw new InvalidPacketException(sprintf('Cannot determine END of message/packet: %s|%s',get_class($o),hex_dump($message)));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$message .= substr($readbuf,$buf_ptr,$end-$buf_ptr);
|
$message .= substr($readbuf,$buf_ptr,$end-$buf_ptr);
|
||||||
|
Loading…
Reference in New Issue
Block a user