modern-email / defects

Collection of real-world email defects
MIT License
7 stars 1 forks source link

Negative number of lines #27

Open duesee opened 4 months ago

duesee commented 4 months ago

An IMAP server tells the number of lines in a message using the body-fld-lines ABNF rule:

body-fld-lines = number
number         = 1*DIGIT
                   ; Unsigned 32-bit integer
                   ; (0 <= n < 4,294,967,296)

According to the standard, negative values are not allowed. Still, Dovecot was observed sending -1 breaking parsing.

Observed in: Exchange/Dovecot (unknown)
Reported: No
Status: Unknown
Comment: Also see https://github.com/emersion/go-imap/issues/534
Proposed solution(s):
    Accept -1, emit warning, and rectify to 0 (implemented in [imap-codec](https://github.com/duesee/imap-codec))