Handle bare codes (an RFC contravention) in SMTP replies, fixes #1017

This commit is contained in:
Marcus Bointon 2017-03-30 15:08:20 +02:00
parent 7115df4a6f
commit 6525e86940
No known key found for this signature in database
GPG Key ID: DE31CD6EB646AA24
2 changed files with 6 additions and 2 deletions

View File

@ -1,5 +1,7 @@
# ChangeLog
* Handle bare codes (an RFC contravention) in SMTP server responses
## Version 5.2.23 (March 15th 2017)
* Improve trapping of TLS errors during connection so that they don't cause warnings, and are reported better in debug output
* Amend test suite so it uses PHPUnit version 4.8, compatible with older versions of PHP, instead of teh version supplied by Travis-CI

View File

@ -1089,8 +1089,10 @@ class SMTP
$this->edebug("SMTP -> get_lines(): \$data is \"$data\"", self::DEBUG_LOWLEVEL);
$this->edebug("SMTP -> get_lines(): \$str is \"$str\"", self::DEBUG_LOWLEVEL);
$data .= $str;
// If 4th character is a space, we are done reading, break the loop, micro-optimisation over strlen
if ((isset($str[3]) and $str[3] == ' ')) {
// If response is only 3 chars (not valid, but RFC5321 S4.2 says it must be handled),
// or 4th character is a space, we are done reading, break the loop,
// string array access is a micro-optimisation over strlen
if (!isset($str[3]) or (isset($str[3]) and $str[3] == ' ')) {
break;
}
// Timed-out? Log and break