[Dovecot] possible bug in lib-mail source

Johann Klasek klasek at zid.tuwien.ac.at
Thu Apr 23 11:29:20 EEST 2009


Browsing through the source code to find some properties of
deliver I stuck here:

--- dovecot-1.2.rc3/src/lib-mail/message-header-parser.c.orig   2009-01-07 19:33:26.000000000 +0100
+++ dovecot-1.2.rc3/src/lib-mail/message-header-parser.c        2009-04-23 09:53:08.000000000 +0200
@@ -284,7 +284,7 @@
                           Exception to this is if the value consists only of
                           LWSP, then skip only the one LWSP after ':'. */
                        for (pos = 0; pos < line->value_len; pos++) {
-                               if (!IS_LWSP(line->value[0]))
+                               if (!IS_LWSP(line->value[pos]))
                                        break;
                        }


I'm not clear if this was really indented but the for-loop does not use
the variable pos in the loop body. The expression
!IS_LWSP(line->value[0]) is invariant and always false if the first
character after ':' is a white space, forcing the loop to go through the
whole value.

This happens only if flag MESSAGE_HEADER_PARSER_FLAG_SKIP_INITIAL_LWSP
is active.

I saw this in 1.1.4 too.

Johann Klasek

-- 
Johann E. Klasek      Zentraler Informatikdienst - Kommunikation
Technische Universität Wien               Tel: +43 1 58801-42049
A-1040 Wien, Wiedner Hauptstr. 8-10/020C  Fax: +43 1 58801-42099
http://pgpkeys.tuwien.ac.at/                   PGP  Key  jklasek


More information about the dovecot mailing list