Skip to content

net/mail: Reading messages with empty bodies returns error (EOF) #15632

Closed
@jspy

Description

@jspy

go version go1.6.1 linux/amd64

Can't read mail messages which are empty. ReadMessage() returns with err = "EOF"

This is due to net/textproto/ReadMIMEHeader -> readContinuedLineSlice() returning an EOF.

Example here:
https://play.golang.org/p/6AYSIRzlwE

Note that mail clients which produce these mail messages are available in the wild, and this specific bug/implementation choice was produced by:

X-Mailer: Apple Mail (2.3124)

A simple fix would probably be to let ReadMIMEHeader in net/textproto/reader.go check if the buffer is empty or not around line 480 instead of just seeing if len(kv) == 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions