]> Cypherpunks repositories - gostls13.git/commitdiff
net: call getSystemDNSConfig inside lookupWithFake to avoid nil dereference panic...
authorMateusz Poliwczak <mpoliwczak34@gmail.com>
Thu, 17 Nov 2022 08:54:48 +0000 (08:54 +0000)
committerGopher Robot <gobot@golang.org>
Fri, 24 Mar 2023 22:53:36 +0000 (22:53 +0000)
It happens with tests that only call lookupWithFake, and before them no-one calls resolverConf.tryUpdate. running alone one of these: TestIssue8434, TestIssueNoSuchHostExists cause a nil dereference panic.

Change-Id: I3fccd96dff5b3c77b5420a7f73742acbafa80142
GitHub-Last-Rev: 7456fd16a7ff4845b4ca305d4107d29f1d6f7b3e
GitHub-Pull-Request: golang/go#56759
Reviewed-on: https://go-review.googlesource.com/c/go/+/450856
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Auto-Submit: Ian Lance Taylor <iant@golang.org>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Damien Neil <dneil@google.com>
src/net/dnsclient_unix_test.go

index 0def954f8ceb6a7177444ef9e514c4b620a91e4d..6deeb39104260ca64cf296da6f7d9b2eef2e5b11 100644 (file)
@@ -1443,7 +1443,7 @@ func TestDNSGoroutineRace(t *testing.T) {
 func lookupWithFake(fake fakeDNSServer, name string, typ dnsmessage.Type) error {
        r := Resolver{PreferGo: true, Dial: fake.DialContext}
 
-       conf := resolvConf.dnsConfig.Load()
+       conf := getSystemDNSConfig()
 
        ctx, cancel := context.WithCancel(context.Background())
        defer cancel()