Fix multiple bugs found in code review - #78
Merged
Conversation
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
defer conn.Close()moved after nil check to prevent panic on connection failuremxresultsappend moved outside SMTPS block so all MX hosts are recorded, not just those with SMTPSif err == nilbranch insideerr != nilblockFatalcalls with proper error returns; added missingresp.Body.Close()io.ReadAllerror check; fixed off-by-one in MX slice ([2:]→[3:]); added bounds checktsv.Writeerrors now checked; addeddefer fd.Close(); returnstsv.Error()at endErrorLoggerwithcontinueinstead of bareprintln; removed duplicateix.dnsbl.manitu.net.entryelse→else if len(in.Answer) > 1prevents index out of bounds ingetA;strings.Split→strings.SplitN(..., 2)for DKIM to handle base64 keys containing=got[0]Test plan
go build ./...passesgo vet ./...passesgo test -v ./...— all tests pass🤖 Generated with Claude Code