[issue34155] email.utils.parseaddr mistakenly parse an email

jpic report at bugs.python.org
Mon Jun 3 03:51:50 EDT 2019


jpic <jpic at yourlabs.org> added the comment:

Thanks for your explanation, but in perspective with other invalid
domains, such as "foo." currently resulting in an empty string too:

>>> email.message_from_string('From: a at foo.',policy=email.policy.default)['from'].addresses[0].domain
''

Do you think this should also change the value of domain to "foo." ?

Also yes with parseaddr it seems that domain is an empty string if it
didn't find a valid domain at all, which is pretty safe in case of
malicious injection attempt - if that's what we're trying to save
python programs from, a clarification of the objective of the patch
would be welcome.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34155>
_______________________________________


More information about the Python-bugs-list mailing list