From 505cf39af9be2cf43461e7d1402f6399d03db720 Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Tue, 9 Aug 2016 21:16:45 -0700 Subject: [PATCH] Fix STARTTLS detection. The previous code was not an impressive demonstration of clear thinking and could reject cases where STARTTLS was actually supported. Change-Id: I27ce8b401447a49be93f58c9e4eb5c5d8e7b73d4 Reviewed-on: https://boringssl-review.googlesource.com/10241 Reviewed-by: Adam Langley Commit-Queue: Adam Langley CQ-Verified: CQ bot account: commit-bot@chromium.org --- tool/transport_common.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tool/transport_common.cc b/tool/transport_common.cc index ed1bc0f95..23fa3bb7a 100644 --- a/tool/transport_common.cc +++ b/tool/transport_common.cc @@ -535,8 +535,7 @@ bool DoSMTPStartTLS(int sock) { } // https://tools.ietf.org/html/rfc1869#section-4.3 - if (reply_250.find("\nSTARTTLS\n") == std::string::npos && - reply_250.find("\nSTARTTLS") != reply_250.size() - 8) { + if (("\n" + reply_250 + "\n").find("\nSTARTTLS\n") == std::string::npos) { fprintf(stderr, "Server does not support STARTTLS\n"); return false; }