Skip to content

Commit

Permalink
lib-smtp: client: Prevent sending an empty XCLIENT command when the f…
Browse files Browse the repository at this point in the history
…irst parameter is long.
  • Loading branch information
stephanbosch authored and villesavolainen committed Feb 6, 2019
1 parent facfea2 commit 5494f65
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib-smtp/smtp-client-connection.c
Expand Up @@ -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 */
Expand Down

0 comments on commit 5494f65

Please sign in to comment.