diff --git a/app/Classes/FTN/Packet.php b/app/Classes/FTN/Packet.php index 8d75c91..31f6df9 100644 --- a/app/Classes/FTN/Packet.php +++ b/app/Classes/FTN/Packet.php @@ -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,11 +303,15 @@ 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)) { - $message .= substr($readbuf,$buf_ptr); - $buf_ptr = 0; + if ($end === FALSE) { + if ($read_ptr < $size) { + $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 { $message .= substr($readbuf,$buf_ptr,$end-$buf_ptr);