From: Stephan Bosch Date: Mon, 3 Dec 2018 23:16:47 +0000 (+0100) Subject: lib-smtp: client: Prevent sending an empty XCLIENT command when the first parameter... X-Git-Tag: 2.3.5~296 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5494f652d571c7eeb2a350cd8391121c7dcf5578;p=thirdparty%2Fdovecot%2Fcore.git lib-smtp: client: Prevent sending an empty XCLIENT command when the first parameter is long. --- diff --git a/src/lib-smtp/smtp-client-connection.c b/src/lib-smtp/smtp-client-connection.c index 1390f29084..35da137e08 100644 --- a/src/lib-smtp/smtp-client-connection.c +++ b/src/lib-smtp/smtp-client-connection.c @@ -650,12 +650,15 @@ smtp_client_connection_xclient_add(struct smtp_client_connection *conn, size_t prev_offset = str_len(str); const char *new_field; + i_assert(prev_offset >= offset); + str_append_c(str, ' '); str_append(str, field); str_append_c(str, '='); smtp_xtext_encode_cstr(str, value); - if (str_len(str) <= SMTP_CLIENT_BASE_LINE_LENGTH_LIMIT) + if (prev_offset == offset || + str_len(str) <= SMTP_CLIENT_BASE_LINE_LENGTH_LIMIT) return; /* preserve field we just added */