Skip to content

Commit

Permalink
Pull request 2095: fix nil deref
Browse files Browse the repository at this point in the history
Squashed commit of the following:

commit 74089af
Author: Eugene Burkov <E.Burkov@AdGuard.COM>
Date:   Tue Dec 5 20:50:12 2023 +0300

    dnsforward: fix nil deref
  • Loading branch information
EugeneOne1 committed Dec 6, 2023
1 parent 99af7f4 commit a0ec0b2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/dnsforward/dnsforward.go
Expand Up @@ -247,7 +247,6 @@ func NewServer(p DNSCreateParams) (s *Server, err error) {
privateNets: p.PrivateNets,
// TODO(e.burkov): Use some case-insensitive string comparison.
localDomainSuffix: strings.ToLower(localDomainSuffix),
etcHosts: p.EtcHosts,
recDetector: newRecursionDetector(recursionTTL, cachedRecurrentReqNum),
clientIDCache: cache.New(cache.Config{
EnableLRU: true,
Expand All @@ -258,6 +257,9 @@ func NewServer(p DNSCreateParams) (s *Server, err error) {
ServePlainDNS: true,
},
}
if p.EtcHosts != nil {
s.etcHosts = p.EtcHosts
}

s.sysResolvers, err = sysresolv.NewSystemResolvers(nil, defaultPlainDNSPort)
if err != nil {
Expand Down

0 comments on commit a0ec0b2

Please sign in to comment.