Address decorations containing backslash chars ('\') can generate emails with invalid headers violating RFC 822

NEW
Unassigned

Status

MailNews Core
Composition
13 years ago
4 months ago

People

(Reporter: Nuno Gonçalo Brito, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

13 years ago
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b5) Gecko/20051006 Firefox/1.4.1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8b5) Gecko/20051006 Firefox/1.4.1

When you enter an unquoted address containing backslash chars, Mozilla
Thunderbird 1.5 Beta 2 gets confused.
If the number of backslahes is odd, it encodes the address as a quoted-string
representing a number of backslahes which is half of, the original number + 1,
e.g. 1 slash remains 1, 3 slashes become 2, 5 become 3, etc:
\ -> \
\\\ -> \\
\\\\\ -> \\\

If the number of backslashes is even it generates email headers containing
exactly what you have typed and as such they violate RFC 822 (Standard for the
format of ARPA Internet text messages) because RFC 822 says that an "atom" may
not contain backslashes and as such a quoted-string is needed instead.
For \\ mozilla uses \\ when it should use "\\\\"

Reproducible: Always

Steps to Reproduce:
Send emails with exactly each of the following in the "To:" field:
a \ b <address@company.domain>
a \\ b <address@company.domain>
a \\\ b <address@company.domain>
a \\\\ b <address@company.domain>
a \\\\\ b <address@company.domain>

Actual Results:  
If you check the message source of the emails in the "Sent" folder you will see
that the following addresses were used:
"a \\ b" <address@company.domain>
a \\ b <address@company.domain>          ---> violates RFC 822
"a \\\\ b" <address@company.domain>
a \\\\ b <address@company.domain>        ---> violates RFC 822
"a \\\\\\ b" <address@company.domain>


Expected Results:  
The expected would be that the addresses were the following:
"a \\ b" <address@company.domain>
"a \\\\ b" <address@company.domain>
"a \\\\\\ b" <address@company.domain>
"a \\\\\\\\ b" <address@company.domain>
"a \\\\\\\\\\ b" <address@company.domain>

In RFC 822 you have:
atom        =  1*<any CHAR except specials, SPACE and CTLs>
specials    =  "(" / ")" / "<" / ">" / "@"  ; Must be in quoted-
            /  "," / ";" / ":" / "\" / <">  ;  string, to use
            /  "." / "[" / "]"              ;  within a word.

Which means that an email with a header like:

To: a \ b <address@company.domain>

Is invalid. It must be:

To: "a \\ b" <address@company.domain>
(Reporter)

Comment 1

13 years ago
Created attachment 200478 [details]
Screenshot showing how the emails are displayed.

The emails that appear in the screenshot were created by inserting exactly the
same text in the "To:" field and in the "Subject:" field.
Example:
To field -> a \ b <address@company.domain>
Subject field -> a \ b
I'm not sure where this should go from Thunderbird: General. Address book? Something else?
Assignee: mscott → nobody
Sounds like a compose problem.
Nuno, does this still occur for you in the latest supported version 2.0.0.16 / trunk nightlies?
It is still a problem on Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1b2pre) Gecko/20081028 SeaMonkey/2.0a2pre and I can bet the code hasn't changed yet.
Status: UNCONFIRMED → NEW
Component: General → Composition
Ever confirmed: true
Product: Thunderbird → MailNews Core
QA Contact: general → composition

Updated

4 months ago
See Also: → bug 1293245
You need to log in before you can comment on or make changes to this bug.