Closed Bug 250559 Opened 20 years ago Closed 20 years ago

don't recognize .CR not as message terminator

Categories

(MailNews Core :: Networking: POP, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ch.ey, Assigned: ch.ey)

Details

Attachments

(1 file)

According to RFC 1939 only .CRLF has to be accepted as terminating.
But currently we also accept .LF and .CR as terminator. The former is because of
restriction in ReadNextLine().
But the later is a bug in HandleLine() that can easily be fixed.
Attached patch proposed patchSplinter Review
This patch is basically a one-liner:
-    if ((line[0] == '.') &&
-	 ((line[1] == nsCRT::CR) || (line[1] == nsCRT::LF)))
+    // line contains only dot and linebreak -> message end
+    if (line[0] == '.' && line_length == 1 + MSG_LINEBREAK_LEN)

Currently everything with dot in the first and CR or LF in the second line is
treated as terminator, also ".\rThis is no terminator"\r\n. This patch changes
this. It tests if the dot is alone on a line with MSG_LINEBREAK (inserted by
|res = BufferInput(MSG_LINEBREAK, MSG_LINEBREAK_LEN);| in
nsPop3Protocol::RetrResponse()).

All the other changes are just cleanups. The removed code junk at #2919 and
following is never triggered, so removed.
Attachment #152684 - Flags: review?(bienvenu)
Comment on attachment 152684 [details] [diff] [review]
proposed patch

is there an advantage to doing this, other than more conformance with the RFC?
Could it break us with some poorly behaved servers?
Attachment #152684 - Flags: review?(bienvenu) → review+
It can break us with those servers. Though the servers not sending CRLF I know
send LF, not CR.
Also accepting single CR and LF can make us terminate the message to early, so I
think the drawback isn't bigger than the gain. Besides from my position that
faulty servers shouldn't make us violate RFC's.
Attachment #152684 - Flags: superreview?(mscott)
Attachment #152684 - Flags: superreview?(mscott) → superreview+
fixed on trunk.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Product: MailNews → Core
Product: Core → MailNews Core
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: