Skip to content

email: address list folding encodes list-separator comma #100884

Description

@t-8ch

Bug report

When during address list folding a separating comma ends up on a folded line containing that is to be unicode-encoded than the separator itself is also unicode encoded. Instead the comma should still a plain comma.

This is rejected by some mail servers:

ZZZ: host YYY said:
    550 Invalid address in message header. Consult RFC2822. (in reply to end of
    DATA command)

Minimal example:

>>> import email
>>> m = email.message.EmailMessage()
>>> t = '01234567890123456789012345678901234567890123456789012345678901@example.org, ä <foo@example.org>'
>>> m['to'] = t
>>> m.as_string()
'to: 01234567890123456789012345678901234567890123456789012345678901@example.org\n =?utf-8?q?=2C?= =?utf-8?q?=C3=A4?= <foo@example.org>\n\n'

Your environment

  • CPython versions tested on: 3.10.9, latest main (e47b139)
  • Operating system and architecture: ArchLinux x86_64

Linked PRs

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    on Jan 9, 2023
  2. added 3 commits that reference this issue on Jan 9, 2023
  3. added a commit that references this issue on Feb 17, 2024
  4. added 2 commits that reference this issue on Feb 17, 2024
  5. added 2 commits that reference this issue on Feb 17, 2024
  6. added a commit that references this issue on Mar 4, 2024
  7. added a commit that references this issue on Apr 17, 2024
  8. added 3 commits that reference this issue on May 16, 2024
  9. added 2 commits that reference this issue on May 22, 2024
  10. added 3 commits that reference this issue on May 22, 2024
  11. added a commit that references this issue on May 23, 2024
  12. added a commit that references this issue on Jul 17, 2024
  13. added a commit that references this issue on Jan 22, 2025
  14. mcepl commented on Mar 11, 2025

    @mcepl
    Contributor

    Shouldn’t CVE-2025-1795 be mentioned here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions