mirror of
https://github.com/golang/go.git
synced 2026-06-27 19:30:52 +00:00
net/mail: escape arbitrary input when including them in errors
This ensures that input with unexpected characters like control characters will not be interpreted in unintended ways should they ever be printed or logged. Change-Id: I9ee18b44d8ca067886dca065e5aae9266a6a6964 Reviewed-on: https://go-review.googlesource.com/c/go/+/780041 Reviewed-by: Roland Shoemaker <roland@golang.org> LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Nicholas Husin <husin@google.com>
This commit is contained in:
parent
0db7bea636
commit
edf006c9a3
1 changed files with 2 additions and 2 deletions
|
|
@ -81,7 +81,7 @@ func readHeader(r *textproto.Reader) (map[string][]string, error) {
|
|||
if err != nil {
|
||||
return m, err
|
||||
}
|
||||
return m, errors.New("malformed initial line: " + line)
|
||||
return m, fmt.Errorf("malformed initial line: %q", line)
|
||||
}
|
||||
|
||||
for {
|
||||
|
|
@ -93,7 +93,7 @@ func readHeader(r *textproto.Reader) (map[string][]string, error) {
|
|||
// Key ends at first colon.
|
||||
k, v, ok := strings.Cut(kv, ":")
|
||||
if !ok {
|
||||
return m, errors.New("malformed header line: " + kv)
|
||||
return m, fmt.Errorf("malformed header line: %q", kv)
|
||||
}
|
||||
key := textproto.CanonicalMIMEHeaderKey(k)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue