-
Notifications
You must be signed in to change notification settings - Fork 18k
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
net/mail: parseAddressList doesn't allow commas with empty email address #36959
Comments
|
@timmydo I think this is reasonable. Want to send the patch above as a CL? See https://tip.golang.org/doc/contribute.html; I'd be happy to review. |
RFC 5322 has a section 4.4 where it says that address-list could have "null" members: "That is, there could be two or more commas in such a list with nothing in between them, or commas at the beginning or end of the list." This change handles such a case so that mail clients using this method on actual email messages get a reasonable return value when they parse email. Fixes golang#36959
RFC 5322 has a section 4.4 where it says that address-list could have "null" members: "That is, there could be two or more commas in such a list with nothing in between them, or commas at the beginning or end of the list." This change handles such a case so that mail clients using this method on actual email messages get a reasonable return value when they parse email. Fixes golang#36959
RFC 5322 has a section 4.4 where it says that address-list could have "null" members: "That is, there could be two or more commas in such a list with nothing in between them, or commas at the beginning or end of the list." This change handles such a case so that mail clients using this method on actual email messages get a reasonable return value when they parse email. Fixes golang#36959
Thanks @mvdan . I created one |
Change https://golang.org/cl/217377 mentions this issue: |
RFC 5322 has a section 4.4 where it says that address-list could have "null" members: "That is, there could be two or more commas in such a list with nothing in between them, or commas at the beginning or end of the list." This change handles such a case so that mail clients using this method on actual email messages get a reasonable return value when they parse email. Fixes golang#36959
RFC 5322 has a section 4.4 where it says that address-list could have "null" members: "That is, there could be two or more commas in such a list with nothing in between them, or commas at the beginning or end of the list." This change handles such a case so that mail clients using this method on actual email messages get a reasonable return value when they parse email. Fixes golang#36959
@mvdan This change appears to have had the side-effect of returning the empty slice and a nil error when the address list is empty. Previously, Line 330 in 30e3bf2
https://play.golang.org/p/R2VdisTd4Wz If this change in behavior was not intended, a fix might be as simple as if p.empty() && len(list) > 0 {
break
} |
Change https://golang.org/cl/248598 mentions this issue: |
This restores the handling accidentally changed in CL 217377. Fixes #40803 For #36959 Change-Id: If77fbc0c2a1dde4799f760affdfb8dde9bcaf458 Reviewed-on: https://go-review.googlesource.com/c/go/+/248598 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Jeremy Fishman <jfishman@cloudflare.com>
Change https://golang.org/cl/251167 mentions this issue: |
This restores the handling accidentally changed in CL 217377. Fixes #40804 For #40803 For #36959 Change-Id: If77fbc0c2a1dde4799f760affdfb8dde9bcaf458 Reviewed-on: https://go-review.googlesource.com/c/go/+/248598 Run-TryBot: Ian Lance Taylor <iant@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc> Reviewed-by: Jeremy Fishman <jfishman@cloudflare.com> (cherry picked from commit 3e636ab) Reviewed-on: https://go-review.googlesource.com/c/go/+/251167
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
net/mail/message.go parseAddressList doesn't allow commas with empty email address. I use an email client that uses this library and it fails to parse some emails.
Here is an example from a mailing list:
What did you expect to see?
I think parseAddressList should filter out empty entries.
RFC 5322 has a section about this. I think it would be nice if empty spaces between commas were passed over.
What did you see instead?
--- FAIL: TestAddressParsing (0.00s)
message_test.go:527: Failed parsing (single) " , joe@where.test": mail: no angle-addr
The text was updated successfully, but these errors were encountered: