diff --git a/app/Classes/FTN/Packet.php b/app/Classes/FTN/Packet.php index 68fc85e..be9f7b3 100644 --- a/app/Classes/FTN/Packet.php +++ b/app/Classes/FTN/Packet.php @@ -267,10 +267,8 @@ class Packet extends FTNBase implements \Iterator, \Countable $message .= substr($readbuf,$buf_ptr,$addchars); $buf_ptr += $addchars; - // If our buffer wasnt big enough... - // @todo can this be true? + // If our buffer wasnt big enough, and thus $addchars didnt have enough chars to add. if ($buf_ptr >= strlen($readbuf)) { - throw new \Exception('We found a situation that this is true'); $buf_ptr = 0; continue; } @@ -302,7 +300,7 @@ class Packet extends FTNBase implements \Iterator, \Countable $last = substr($readbuf,-2); // We have an EOM or EOP marker here, so loop around to get the next read - if (str_contains($last,"\x00")) { + if (str_contains($last,"\x00") && ($size < $read_ptr)) { $message .= substr($readbuf,$buf_ptr); $buf_ptr = 0;