From: Timo Sirainen Date: Thu, 14 Oct 2021 22:11:06 +0000 (+0200) Subject: imap-login: proxy: Fix STARTTLS failure message X-Git-Tag: 2.4.0~4244 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e9d8c06acb6670b115669c17a23d92bfdd2193d4;p=thirdparty%2Fdovecot%2Fcore.git imap-login: proxy: Fix STARTTLS failure message The error message blindly skipped over 3 bytes after the tagged "S " reply. This was okay if the reply was "NO", but wrong if the reply was "BAD". Also nothing really guarantees that a broken server couldn't have just returned a truncated "S " string, in which case the error would point to garbage. --- diff --git a/src/imap-login/imap-proxy.c b/src/imap-login/imap-proxy.c index 75f874e9b3..042b24a76f 100644 --- a/src/imap-login/imap-proxy.c +++ b/src/imap-login/imap-proxy.c @@ -367,7 +367,7 @@ int imap_proxy_parse_line(struct client *client, const char *line) /* STARTTLS failed */ const char *reason = t_strdup_printf( "STARTTLS failed: %s", - str_sanitize(line + 5, 160)); + str_sanitize(line + 2, 160)); login_proxy_failed(client->login_proxy, login_proxy_get_event(client->login_proxy), LOGIN_PROXY_FAILURE_TYPE_REMOTE, reason);