panic in client.go if stamp DNS response has no TXT records (and under other conditions)
ainar-g opened this issue · 0 comments
ainar-g commented
See AdguardTeam/AdGuardHome#5557. Client.DialStamp
uses Client.fetchCert
, which has bad error handling. certErr
is overwritten on every iteration of the loop over r.Answer
and is never set at all if there are no answers or if none of the answers are TXT. That results in Client.fetchCert
returning nil, nil
, which leads to a panic in Client.DialStamp
.
Client.fetchCert
has a cyclomatic complexity of 14 and a cognitive complexity of 23 and needs refactoring.