]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: message-header-encode - Return immediately when len == 0 in message_header_...
authorStephan Bosch <stephan.bosch@open-xchange.com>
Wed, 16 Sep 2020 01:10:12 +0000 (03:10 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Wed, 7 Oct 2020 14:08:11 +0000 (14:08 +0000)
Just to make sure. This shouldn't happen in the first place.

src/lib-mail/message-header-encode.c

index ff5b96d8e9340811b3a67ed31d63ce55e9ba1bbc..632f47260300e6bab1953fa77f1231a2ce01eb2f 100644 (file)
@@ -61,6 +61,9 @@ void message_header_encode_q(const unsigned char *input, size_t len,
 {
        size_t i, line_len_left;
 
+       if (len == 0)
+               return;
+
        line_len_left = MIME_MAX_LINE_LEN - MIME_WRAPPER_LEN;
 
        if (first_line_len >= MIME_MAX_LINE_LEN - MIME_WRAPPER_LEN - 3) {
@@ -112,6 +115,9 @@ void message_header_encode_b(const unsigned char *input, size_t len,
 {
        size_t line_len, line_len_left, max;
 
+       if (len == 0)
+               return;
+
        line_len = first_line_len;
        if (line_len >= MIME_MAX_LINE_LEN - MIME_WRAPPER_LEN) {
                str_append(output, "\n\t");