POP3 RETR is missing dot-stuffing and CRLF termination #3

Closed
opened 2026-06-17 17:12:07 +01:00 by lyrathorpe · 0 comments
Owner

handle_retr (proxy_server.py:271) writes the raw body and then a "." terminator with no byte-stuffing.

RFC 1939 requires, for multi-line responses:

  • Any line beginning with "." must be byte-stuffed with a leading ".".
  • The body must be CRLF-terminated before the "."CRLF terminator.

A message containing a line starting with "." (e.g. ".signature") or a body not ending in CRLF will truncate or corrupt the transfer.

Fix:

  • Normalise line endings to CRLF.
  • Byte-stuff lines beginning with ".".
  • Emit the terminating "."CRLF on its own line.

Acceptance:

  • A message body containing a line beginning with "." is transferred intact.
handle_retr (proxy_server.py:271) writes the raw body and then a "." terminator with no byte-stuffing. RFC 1939 requires, for multi-line responses: - Any line beginning with "." must be byte-stuffed with a leading ".". - The body must be CRLF-terminated before the "."CRLF terminator. A message containing a line starting with "." (e.g. ".signature") or a body not ending in CRLF will truncate or corrupt the transfer. Fix: - Normalise line endings to CRLF. - Byte-stuff lines beginning with ".". - Emit the terminating "."CRLF on its own line. Acceptance: - A message body containing a line beginning with "." is transferred intact.
lyrathorpe added the bug label 2026-06-17 17:12:07 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: lyrathorpe/legacy-email-proxy#3