Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative number of lines #27

Open
duesee opened this issue May 11, 2024 · 0 comments
Open

Negative number of lines #27

duesee opened this issue May 11, 2024 · 0 comments
Labels
PROTO=IMAP Related to IMAP protocol STATE=UNKNOWN More information needed

Comments

@duesee
Copy link
Member

duesee commented May 11, 2024

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))
@duesee duesee added PROTO=IMAP Related to IMAP protocol STATE=REPRODUCED Issue could be reproduced (explained in issue) labels May 11, 2024
@duesee duesee changed the title Negative line length breaks parsing Negative number of lines May 11, 2024
@duesee duesee added HELP WANTED STATE=UNKNOWN More information needed and removed HELP WANTED STATE=REPRODUCED Issue could be reproduced (explained in issue) labels May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PROTO=IMAP Related to IMAP protocol STATE=UNKNOWN More information needed
Projects
None yet
Development

No branches or pull requests

1 participant