From 188cc38e2ec9eaa125a4e62fbfb391c77a2eabba Mon Sep 17 00:00:00 2001 From: Marcus Bointon Date: Mon, 18 Nov 2019 16:21:07 +0100 Subject: [PATCH] Use a constant to make it clear where this value comes from --- src/SMTP.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/SMTP.php b/src/SMTP.php index 193da988..f98c580b 100644 --- a/src/SMTP.php +++ b/src/SMTP.php @@ -57,6 +57,15 @@ class SMTP */ const MAX_LINE_LENGTH = 998; + /** + * The maximum line length allowed for replies in RFC 5321 section 4.5.3.1.5, + * *including* a trailing CRLF line break. + * @see https://tools.ietf.org/html/rfc5321#section-4.5.3.1.5 + * + * @var int + */ + const MAX_REPLY_LENGTH = 512; + /** * Debug level for no output. * @@ -1161,7 +1170,7 @@ class SMTP break; } //Deliberate noise suppression - errors are handled afterwards - $str = @fgets($this->smtp_conn, 515); + $str = @fgets($this->smtp_conn, self::MAX_REPLY_LENGTH); $this->edebug('SMTP INBOUND: "' . trim($str) . '"', self::DEBUG_LOWLEVEL); $data .= $str; // If response is only 3 chars (not valid, but RFC5321 S4.2 says it must be handled),