Skip to content

panic in client.go if stamp DNS response has no TXT records (and under other conditions) #18

@ainar-g

Description

@ainar-g

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions