Skip to content

Fix multiple bugs found in code review - #78

Merged
steffenfritz merged 1 commit into
mainfrom
bug-fixes-code-review
Mar 28, 2026
Merged

Fix multiple bugs found in code review#78
steffenfritz merged 1 commit into
mainfrom
bug-fixes-code-review

Conversation

@steffenfritz

Copy link
Copy Markdown
Owner

Summary

  • openrelay: defer conn.Close() moved after nil check to prevent panic on connection failure
  • main: mxresults append moved outside SMTPS block so all MX hosts are recorded, not just those with SMTPS
  • tlscheck: removed dead if err == nil branch inside err != nil block
  • checkversion: replaced Fatal calls with proper error returns; added missing resp.Body.Close()
  • mtasts: added 10s HTTP timeout; fixed missing io.ReadAll error check; fixed off-by-one in MX slice ([2:][3:]); added bounds check
  • output: all tsv.Write errors now checked; added defer fd.Close(); returns tsv.Error() at end
  • blacklists: DNS errors now use ErrorLogger with continue instead of bare println; removed duplicate ix.dnsbl.manitu.net. entry
  • dns: elseelse if len(in.Answer) > 1 prevents index out of bounds in getA; strings.Splitstrings.SplitN(..., 2) for DKIM to handle base64 keys containing =
  • connect_test: added bounds check before accessing got[0]

Test plan

  • go build ./... passes
  • go vet ./... passes
  • go test -v ./... — all tests pass

🤖 Generated with Claude Code

- openrelay: defer conn.Close() after nil check to prevent panic
- main: move mxresults append outside SMTPS block so all MX hosts are recorded
- tlscheck: remove dead 'if err == nil' inside err != nil block
- checkversion: return errors instead of Fatal; add missing resp.Body.Close()
- mtasts: add HTTP timeout, fix missing error check, off-by-one in MX slice, add bounds check
- output: check all tsv.Write errors; add defer fd.Close(); return tsv.Error()
- blacklists: use ErrorLogger and continue on DNS error; remove duplicate DNSBL entry
- dns: fix potential index out of bounds in getA; use SplitN for DKIM parsing
- connect_test: add bounds check before accessing got[0]

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Steffen Fritz <steffen@fritz.wtf>
@steffenfritz steffenfritz self-assigned this Mar 28, 2026
@steffenfritz steffenfritz added this to the v1.9.0 milestone Mar 28, 2026
@steffenfritz
steffenfritz merged commit 28f62b9 into main Mar 28, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant