]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-mail: Add assert to ensure we don't overstep in input_idx_need_encoding
authorAki Tuomi <aki.tuomi@open-xchange.com>
Thu, 23 Jan 2020 07:54:44 +0000 (09:54 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 5 Feb 2020 12:10:32 +0000 (12:10 +0000)
Satisfies static analysers.

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

index 38cb86b2454653c3a9a1790b6a2ff95808ac374a..35454aa67b703b45ab2bd517fa691c19fa5565c2 100644 (file)
@@ -25,6 +25,7 @@ static bool input_idx_need_encoding(const unsigned char *input,
                        /* trailing LF - we need to drop it */
                        return TRUE;
                }
+               i_assert(i+1 < len);
                if (input[i+1] != '\t' && input[i+1] != ' ') {
                        /* LF not followed by whitespace - we need to
                           add the whitespace */