]> Cypherpunks repositories - gostls13.git/commitdiff
net: fix cgoResSearch
authordatabase64128 <free122448@hotmail.com>
Mon, 18 Aug 2025 08:55:40 +0000 (16:55 +0800)
committerGopher Robot <gobot@golang.org>
Mon, 25 Aug 2025 17:50:07 +0000 (10:50 -0700)
CL 457439 mistakenly redeclared size inside the for loop, causing
cgoResSearch to always fail and fall back to goLookupCNAME.

Change-Id: I3e142d34287388284a8998ac13761b1e0c2911a5
Reviewed-on: https://go-review.googlesource.com/c/go/+/696895
Reviewed-by: Damien Neil <dneil@google.com>
Auto-Submit: Damien Neil <dneil@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Mateusz Poliwczak <mpoliwczak34@gmail.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>

src/net/cgo_unix.go

index 3afa014b6f7b5477d0cf521e23b2b4998094edc4..1e170dbc0afb2432b16fef258a89dac5a04cff16 100644 (file)
@@ -351,7 +351,7 @@ func cgoResSearch(hostname string, rtype, class int) ([]dnsmessage.Resource, err
 
        var size int
        for {
-               size := _C_res_nsearch(state, (*_C_char)(unsafe.Pointer(s)), class, rtype, buf, bufSize)
+               size = _C_res_nsearch(state, (*_C_char)(unsafe.Pointer(s)), class, rtype, buf, bufSize)
                if size <= 0 || size > 0xffff {
                        return nil, errors.New("res_nsearch failure")
                }