]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-smtp: client: Prevent sending an empty XCLIENT command when the first parameter...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Mon, 3 Dec 2018 23:16:47 +0000 (00:16 +0100)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 6 Feb 2019 08:09:21 +0000 (10:09 +0200)
src/lib-smtp/smtp-client-connection.c

index 1390f29084357edbd9ea92cb33d2cf7a4158bc76..35da137e08f8c9591d3a26fd8ee1181d572cfec9 100644 (file)
@@ -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 */