matcha
matcha copied to clipboard
BUG: Unchecked error on quoted-printable writer Close()
Describe the bug
In sender/sender.go line 220, quotedprintable.NewWriter().Close() error is ignored:
var encBody bytes.Buffer
qp := quotedprintable.NewWriter(&encBody)
fmt.Fprint(qp, plainBody)
qp.Close() // Error ignored
encodedBody := encBody.Bytes()
If Close() fails (write errors, flush failures), encoded body may be incomplete/corrupted but code proceeds silently.
To reproduce
- Compose email with plain text body
- Simulate write error during quoted-printable encoding
Close()fails but error not caught- Corrupted email sent
Expected behavior
Check Close() error:
var encBody bytes.Buffer
qp := quotedprintable.NewWriter(&encBody)
if _, err := fmt.Fprint(qp, plainBody); err != nil {
return err
}
if err := qp.Close(); err != nil {
return fmt.Errorf("quoted-printable encoding failed: %w", err)
}
encodedBody := encBody.Bytes()
Screenshots
N/A
Additional context
- File:
sender/sender.go - Lines: 217-221
- Severity: Medium - email body corruption
- Fix complexity: Easy - add error check
This has had no activity for 30 days. It will be closed in 14 days unless updated. Comment or remove the stale label to keep it open.