You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The CAPA response termination check treats any line that begins with '.' as the terminating line rather than requiring a single '.' line. According to POP3 multi-line response rules, the terminator is a line consisting of only a single dot ("."), so a line like ".capability" would be misinterpreted as the end of the CAPA response. This can cause premature termination of capability parsing and missing or incorrect capability handling.
The problem's in pop3_endofresp() it's checking len >= 1 && line[0] == '.' which matches any line starting with a dot, not just the terminator. RFC 2449 says the terminator has to be a line with only a single dot.
Changed it to check for exact match: length 3 with .\r or length 2 with .\n (to handle LF-only servers) similar to how IMAP does continuation checks.
Ran all 37 POP3 tests, everything passes. The bug's theoretical anyway since capability names can't start with . per the RFC, but might as well get it right.
Activity
pop3: fix CAPA response termination detection
thebitbrine commentedon Oct 26, 2025
Found the issue and put up a fix in #19245.
The problem's in
pop3_endofresp()it's checkinglen >= 1 && line[0] == '.'which matches any line starting with a dot, not just the terminator. RFC 2449 says the terminator has to be a line with only a single dot.Changed it to check for exact match: length 3 with
.\ror length 2 with.\n(to handle LF-only servers) similar to how IMAP does continuation checks.Ran all 37 POP3 tests, everything passes. The bug's theoretical anyway since capability names can't start with
.per the RFC, but might as well get it right.pop3: fix CAPA response termination detection