<<< Date Index >>>     <<< Thread Index >>>

Re: [Mutt] #1062: rfc2047 encoded headers incorrectly parsed



#1062: rfc2047 encoded headers incorrectly parsed
------------------------------------------------------+---------------------
  Reporter:  Pavel Troller <patrol@xxxxxxxxxxxxxxxx>  |       Owner:  mutt-dev  
   
      Type:  enhancement                              |      Status:  closed    
   
  Priority:  trivial                                  |   Milestone:            
   
 Component:  mutt                                     |     Version:  1.3.27i   
   
Resolution:  invalid                                  |    Keywords:  patch 
#364941
------------------------------------------------------+---------------------
Changes (by pdmef):

  * status:  new => closed
  * resolution:  => invalid


Old description:

> {{{
> Package: mutt
> Version: 1.3.27i
> Severity: normal
>
> -- Please type your report below this line
> This version of mutt doesn't recognize rfc2047 headers, if the encoded
> portion contains spaces.
> mutt-1.2.5, which I've been using for a long time, did this correctly.
> I don't know the exact syntax of rfc2047, maybe spaces are forbidden
> here,
> but many UAs are putting spaces into the quoted-printable encoded
> headers.
>
> The problem is in rfc2047.c, in find_encoded_word().
>
> I've made the following change to fix this problem:
> --- rfc2047.c.orig      Thu Feb 21 11:56:09 2002
> +++ rfc2047.c   Thu Feb 21 11:35:15 2002
> @@ -701,12 +701,12 @@
>    while ((p = strstr (q, "=?")))
>    {
>      for (q = p + 2;
> -        0x20 < *q && *q < 0x7f && !strchr ("()<>@,;:\"/[]?.=", *q);
> +        0x20 <= *q && *q < 0x7f && !strchr ("()<>@,;:\"/[]?.=", *q);
>          q++)
>        ;
>      if (q[0] != '?' || !strchr ("BbQq", q[1]) || q[2] != '?')
>        continue;
> -    for (q = q + 3; 0x20 < *q && *q < 0x7f && *q != '?'; q++)
> +    for (q = q + 3; 0x20 <= *q && *q < 0x7f && *q != '?'; q++)
>        ;
>      if (q[0] != '?' || q[1] != '=')
>      {
>
>                                           With regards, Pavel Troller
>
> -- Build environment information
>
> (Note: This is the build environment installed on the system
> muttbug is run on.  Information may or may not match the environment
> used to build mutt.)
>
> - gcc version information
> gcc
> Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/specs
> gcc version 2.95.3 20010315 (release)
>
> - CFLAGS
> -Wall -pedantic -O2 -march=i586 -mcpu=i586 -fomit-frame-pointer -fforce-
> mem -fforce-addr
>
> -- Mutt Version Information
>
> Mutt 1.3.27i (2002-01-22)
> Copyright (C) 1996-2001 Michael R. Elkins and others.
> Mutt comes with ABSOLUTELY NO WARRANTY; for details type `mutt -vv'.
> Mutt is free software, and you are welcome to redistribute it
> under certain conditions; type `mutt -vv' for details.
>
> System: Linux 2.4.17 (i686) [using ncurses 5.2]
> Compile options:
> -DOMAIN
> -DEBUG
> -HOMESPOOL  +USE_SETGID  +USE_DOTLOCK  +DL_STANDALONE
> +USE_FCNTL  -USE_FLOCK
> +USE_POP  +USE_IMAP  -USE_GSS  +USE_SSL  -USE_SASL
> +HAVE_REGCOMP  -USE_GNU_REGEX
> +HAVE_COLOR  +HAVE_START_COLOR  +HAVE_TYPEAHEAD  +HAVE_BKGDSET
> +HAVE_CURS_SET  +HAVE_META  +HAVE_RESIZETERM
> +HAVE_PGP  -BUFFY_SIZE -EXACT_ADDRESS  -SUN_ATTACHMENT
> +ENABLE_NLS  -LOCALES_HACK  +HAVE_WC_FUNCS  +HAVE_LANGINFO_CODESET
> +HAVE_LANGINFO_YESEXPR
> +HAVE_ICONV  -ICONV_NONTRANS  +HAVE_GETSID  +HAVE_GETADDRINFO
> ISPELL="/usr/bin/ispell"
> SENDMAIL="/usr/sbin/sendmail"
> MAILPATH="/var/mail"
> PKGDATADIR="/usr/share/mutt"
> SYSCONFDIR="/etc"
> EXECSHELL="/bin/sh"
> -MIXMASTER
> To contact the developers, please mail to <mutt-dev@xxxxxxxx>.
> To report a bug, please use the flea(1) utility.
>

> Received: (at submit) by bugs.guug.de; 26 Dec 2001 00:35:23 +0000
> From askwar@xxxxxxxxxxxxxxxxxxx Wed Dec 26 01:35:23 2001
> Received: from basket.ball.reliam.net ([213.91.6.7])
>         by trithemius.gnupg.org with esmtp (Exim 3.12 #1 (Debian))
>         id 16J22V-0001Wd-00
>         for <submit@xxxxxxxxxxxx>; Wed, 26 Dec 2001 01:35:23 +0100
> Received: from teich.garten.digitalprojects.com
> (pD9E67FBF.dip.t-dialin.net [217.230.127.191])
>         by basket.ball.reliam.net (Postfix) with ESMTP
>         id 444843DAC; Wed, 26 Dec 2001 01:33:24 +0100 (CET)
> Received: by teich.garten.digitalprojects.com (Postfix, from userid 501)
>         id 463F5B5D8F; Wed, 26 Dec 2001 01:33:21 +0100 (CET)
> Subject: mutt-1.3.24i: mutt doesn't correctly handle badly formated
> quoted-printable
> To: submit@xxxxxxxxxxxx
> Message-Id: <20011226003321.463F5B5D8F@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
> Date: Wed, 26 Dec 2001 01:33:21 +0100 (CET)
> From: askwar@xxxxxxxxxxxxxxxxxxx (Alexander Skwar)
>
> Package: mutt
> Version: 1.3.24i
> Severity: important
>
> -- Please type your report below this line
>
> Some MUAs (like PostMe or Jubii mailer (Mime.MMail, ver: 2,4,0,15) used
> by
> Lycos), produce badly formated quoted-printable encoded words in the
> header fields.
>
> For example, "Jubii mailer" sent me this mail (only copying relevant
> headers):
>
> +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
>
> From pruegelpause@xxxxxxxxxxxxxxxx  Mon Dec 24 17:30:10 2001
> Return-Path: <pruegelpause@xxxxxxxxxxxxxxxx>
> MIME-Version: 1.0
> X-Mailer: Jubii mailer (Mime.MMail, ver: 2,4,0,15)
> From: =?iso-8859-1?Q? "Lycos_Pr=FCgelpause" ?= <pruegelpause@lycos-
> europe.com>
> Subject: Du wurdest herausgefordert
> To: "" <ASkwar@xxxxxxxxxxxxxxxxxxx>
> Content-Type: Multipart/Alternative;
>   boundary="------------Boundary-00=_8CWUHW9GSSJ4GPWWKFN2"
> Message-ID: <VIRALRELAYSRV1F8GL1000fe1a9@xxxxxxxxxxxxxxxxxxxxxxx>
>
> Content-Type: Text/Plain
> Content-Transfer-Encoding: quoted-printable
>
> =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
>
> The 2nd Content-Type "header" is because Lycos sends out HTML mail.
> Anyways,
> PostMe also sends out mails with a From: which is just as broken.  As you
> can
> see, the "quoted-printable" encoded-word contains both SPACE and ";
> neither of
> these characters is allowed according to RFC 2047.
>
> However, the IETF motto is: "Be strict in what you produce and tolerant
> to what
> you receive." Mutt should be able to handle this, even if it's broken.
>
> -- Build environment information
>
> (Note: This is the build environment installed on the system
> muttbug is run on.  Information may or may not match the environment
> used to build mutt.)
>
> - gcc version information
> gcc
> Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/specs
> gcc version 2.96 20000731 (Mandrake Linux 8.2 2.96-0.68mdk)
>
> - CFLAGS
> -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -ffast-math
> -fno-strength-reduce
>
> -- Mutt Version Information
>
> Mutt 1.3.24i (2001-11-29)
> Copyright (C) 1996-2001 Michael R. Elkins und andere.
> Mutt übernimmt KEINERLEI GEWÄHRLEISTUNG. Starten Sie `mutt -vv', um
> weitere Details darüber zu erfahren. Mutt ist freie Software.
> Sie können es unter bestimmten Bedingungen weitergeben; starten Sie
> `mutt -vv' für weitere Details.
>
> System: Linux 2.4.13-12mdk (i686) [using ncurses 5.2]
> Einstellungen bei der Compilierung:
> -DOMAIN
> +DEBUG
> -HOMESPOOL  +USE_SETGID  +USE_DOTLOCK  +DL_STANDALONE
> +USE_FCNTL  -USE_FLOCK
> +USE_POP  +USE_IMAP  -USE_GSS  +USE_SSL  -USE_SASL
> +HAVE_REGCOMP  -USE_GNU_REGEX
> +HAVE_COLOR  +HAVE_START_COLOR  +HAVE_TYPEAHEAD  +HAVE_BKGDSET
> +HAVE_CURS_SET  +HAVE_META  +HAVE_RESIZETERM
> +HAVE_PGP  -BUFFY_SIZE -EXACT_ADDRESS  -SUN_ATTACHMENT
> +ENABLE_NLS  -LOCALES_HACK  +COMPRESSED  +HAVE_WC_FUNCS
> +HAVE_LANGINFO_CODESET  +HAVE_LANGINFO_YESEXPR
> +HAVE_ICONV  -ICONV_NONTRANS  +HAVE_GETSID  +HAVE_GETADDRINFO
> ISPELL="/usr/bin/ispell"
> SENDMAIL="/usr/sbin/sendmail"
> MAILPATH="/var/mail"
> PKGDATADIR="/usr/share/mutt"
> SYSCONFDIR="/etc"
> EXECSHELL="/bin/sh"
> -MIXMASTER
> Um die Entwickler zu kontaktieren, schicken Sie bitte
> eine Nachricht (in englisch) an <mutt-dev@xxxxxxxx>.
> Um einen Bug zu melden, verwenden Sie bitte das Programm flea(1).
>
> patch-1.3.24.rr.compressed.1
>

> >How-To-Repeat:
> >Fix:
> }}}

New description:

 {{{
 Package: mutt
 Version: 1.3.27i
 Severity: normal

 -- Please type your report below this line
 This version of mutt doesn't recognize rfc2047 headers, if the encoded
 portion contains spaces.
 mutt-1.2.5, which I've been using for a long time, did this correctly.
 I don't know the exact syntax of rfc2047, maybe spaces are forbidden here,
 but many UAs are putting spaces into the quoted-printable encoded headers.

 The problem is in rfc2047.c, in find_encoded_word().

 I've made the following change to fix this problem:
 --- rfc2047.c.orig      Thu Feb 21 11:56:09 2002
 +++ rfc2047.c   Thu Feb 21 11:35:15 2002
 @@ -701,12 +701,12 @@
    while ((p = strstr (q, "=?")))
    {
      for (q = p + 2;
 -        0x20 < *q && *q < 0x7f && !strchr ("()<>@,;:\"/[]?.=", *q);
 +        0x20 <= *q && *q < 0x7f && !strchr ("()<>@,;:\"/[]?.=", *q);
          q++)
        ;
      if (q[0] != '?' || !strchr ("BbQq", q[1]) || q[2] != '?')
        continue;
 -    for (q = q + 3; 0x20 < *q && *q < 0x7f && *q != '?'; q++)
 +    for (q = q + 3; 0x20 <= *q && *q < 0x7f && *q != '?'; q++)
        ;
      if (q[0] != '?' || q[1] != '=')
      {

                                           With regards, Pavel Troller

 -- Build environment information

 (Note: This is the build environment installed on the system
 muttbug is run on.  Information may or may not match the environment
 used to build mutt.)

 - gcc version information
 gcc
 Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/2.95.3/specs
 gcc version 2.95.3 20010315 (release)

 - CFLAGS
 -Wall -pedantic -O2 -march=i586 -mcpu=i586 -fomit-frame-pointer -fforce-
 mem -fforce-addr

 -- Mutt Version Information

 Mutt 1.3.27i (2002-01-22)
 Copyright (C) 1996-2001 Michael R. Elkins and others.
 Mutt comes with ABSOLUTELY NO WARRANTY; for details type `mutt -vv'.
 Mutt is free software, and you are welcome to redistribute it
 under certain conditions; type `mutt -vv' for details.

 System: Linux 2.4.17 (i686) [using ncurses 5.2]
 Compile options:
 -DOMAIN
 -DEBUG
 -HOMESPOOL  +USE_SETGID  +USE_DOTLOCK  +DL_STANDALONE
 +USE_FCNTL  -USE_FLOCK
 +USE_POP  +USE_IMAP  -USE_GSS  +USE_SSL  -USE_SASL
 +HAVE_REGCOMP  -USE_GNU_REGEX
 +HAVE_COLOR  +HAVE_START_COLOR  +HAVE_TYPEAHEAD  +HAVE_BKGDSET
 +HAVE_CURS_SET  +HAVE_META  +HAVE_RESIZETERM
 +HAVE_PGP  -BUFFY_SIZE -EXACT_ADDRESS  -SUN_ATTACHMENT
 +ENABLE_NLS  -LOCALES_HACK  +HAVE_WC_FUNCS  +HAVE_LANGINFO_CODESET
 +HAVE_LANGINFO_YESEXPR
 +HAVE_ICONV  -ICONV_NONTRANS  +HAVE_GETSID  +HAVE_GETADDRINFO
 ISPELL="/usr/bin/ispell"
 SENDMAIL="/usr/sbin/sendmail"
 MAILPATH="/var/mail"
 PKGDATADIR="/usr/share/mutt"
 SYSCONFDIR="/etc"
 EXECSHELL="/bin/sh"
 -MIXMASTER
 To contact the developers, please mail to <mutt-dev@xxxxxxxx>.
 To report a bug, please use the flea(1) utility.


 Received: (at submit) by bugs.guug.de; 26 Dec 2001 00:35:23 +0000
 From askwar@xxxxxxxxxxxxxxxxxxx Wed Dec 26 01:35:23 2001
 Received: from basket.ball.reliam.net ([213.91.6.7])
         by trithemius.gnupg.org with esmtp (Exim 3.12 #1 (Debian))
         id 16J22V-0001Wd-00
         for <submit@xxxxxxxxxxxx>; Wed, 26 Dec 2001 01:35:23 +0100
 Received: from teich.garten.digitalprojects.com
 (pD9E67FBF.dip.t-dialin.net [217.230.127.191])
         by basket.ball.reliam.net (Postfix) with ESMTP
         id 444843DAC; Wed, 26 Dec 2001 01:33:24 +0100 (CET)
 Received: by teich.garten.digitalprojects.com (Postfix, from userid 501)
         id 463F5B5D8F; Wed, 26 Dec 2001 01:33:21 +0100 (CET)
 Subject: mutt-1.3.24i: mutt doesn't correctly handle badly formated
 quoted-printable
 To: submit@xxxxxxxxxxxx
 Message-Id: <20011226003321.463F5B5D8F@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
 Date: Wed, 26 Dec 2001 01:33:21 +0100 (CET)
 From: askwar@xxxxxxxxxxxxxxxxxxx (Alexander Skwar)

 Package: mutt
 Version: 1.3.24i
 Severity: important

 -- Please type your report below this line

 Some MUAs (like PostMe or Jubii mailer (Mime.MMail, ver: 2,4,0,15) used by
 Lycos), produce badly formated quoted-printable encoded words in the
 header fields.

 For example, "Jubii mailer" sent me this mail (only copying relevant
 headers):

 +=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

 From pruegelpause@xxxxxxxxxxxxxxxx  Mon Dec 24 17:30:10 2001
 Return-Path: <pruegelpause@xxxxxxxxxxxxxxxx>
 MIME-Version: 1.0
 X-Mailer: Jubii mailer (Mime.MMail, ver: 2,4,0,15)
 From: =?iso-8859-1?Q? "Lycos_Pr=FCgelpause" ?= <pruegelpause@lycos-
 europe.com>
 Subject: Du wurdest herausgefordert
 To: "" <ASkwar@xxxxxxxxxxxxxxxxxxx>
 Content-Type: Multipart/Alternative;
   boundary="------------Boundary-00=_8CWUHW9GSSJ4GPWWKFN2"
 Message-ID: <VIRALRELAYSRV1F8GL1000fe1a9@xxxxxxxxxxxxxxxxxxxxxxx>

 Content-Type: Text/Plain
 Content-Transfer-Encoding: quoted-printable

 =+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+

 The 2nd Content-Type "header" is because Lycos sends out HTML mail.
 Anyways,
 PostMe also sends out mails with a From: which is just as broken.  As you
 can
 see, the "quoted-printable" encoded-word contains both SPACE and ";
 neither of
 these characters is allowed according to RFC 2047.

 However, the IETF motto is: "Be strict in what you produce and tolerant to
 what
 you receive." Mutt should be able to handle this, even if it's broken.

 -- Build environment information

 (Note: This is the build environment installed on the system
 muttbug is run on.  Information may or may not match the environment
 used to build mutt.)

 - gcc version information
 gcc
 Reading specs from /usr/lib/gcc-lib/i586-mandrake-linux-gnu/2.96/specs
 gcc version 2.96 20000731 (Mandrake Linux 8.2 2.96-0.68mdk)

 - CFLAGS
 -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -ffast-math
 -fno-strength-reduce

 -- Mutt Version Information

 Mutt 1.3.24i (2001-11-29)
 Copyright (C) 1996-2001 Michael R. Elkins und andere.
 Mutt übernimmt KEINERLEI GEWÄHRLEISTUNG. Starten Sie `mutt -vv', um
 weitere Details darüber zu erfahren. Mutt ist freie Software.
 Sie können es unter bestimmten Bedingungen weitergeben; starten Sie
 `mutt -vv' für weitere Details.

 System: Linux 2.4.13-12mdk (i686) [using ncurses 5.2]
 Einstellungen bei der Compilierung:
 -DOMAIN
 +DEBUG
 -HOMESPOOL  +USE_SETGID  +USE_DOTLOCK  +DL_STANDALONE
 +USE_FCNTL  -USE_FLOCK
 +USE_POP  +USE_IMAP  -USE_GSS  +USE_SSL  -USE_SASL
 +HAVE_REGCOMP  -USE_GNU_REGEX
 +HAVE_COLOR  +HAVE_START_COLOR  +HAVE_TYPEAHEAD  +HAVE_BKGDSET
 +HAVE_CURS_SET  +HAVE_META  +HAVE_RESIZETERM
 +HAVE_PGP  -BUFFY_SIZE -EXACT_ADDRESS  -SUN_ATTACHMENT
 +ENABLE_NLS  -LOCALES_HACK  +COMPRESSED  +HAVE_WC_FUNCS
 +HAVE_LANGINFO_CODESET  +HAVE_LANGINFO_YESEXPR
 +HAVE_ICONV  -ICONV_NONTRANS  +HAVE_GETSID  +HAVE_GETADDRINFO
 ISPELL="/usr/bin/ispell"
 SENDMAIL="/usr/sbin/sendmail"
 MAILPATH="/var/mail"
 PKGDATADIR="/usr/share/mutt"
 SYSCONFDIR="/etc"
 EXECSHELL="/bin/sh"
 -MIXMASTER
 Um die Entwickler zu kontaktieren, schicken Sie bitte
 eine Nachricht (in englisch) an <mutt-dev@xxxxxxxx>.
 Um einen Bug zu melden, verwenden Sie bitte das Programm flea(1).

 patch-1.3.24.rr.compressed.1


 >How-To-Repeat:
 >Fix:
 }}}

--

Comment:

 Since nobody asked again in years and the request would break mutt, I'm
 closing this ticket.

-- 
Ticket URL: <http://dev.mutt.org/trac/ticket/1062#comment:19>
Mutt <http://www.mutt.org/>
The Mutt mail user agent