github-vet / github-vet/rangeloop-pointer-findings
wenfang/golang1.6-src: src/net/dnsclient_unix.go; 22 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [wenfang/golang1.6-src](https://www.github.com/wenfang/golang1.6-src) at [src/net/dnsclient_unix.go](https://github.com/wenfang/golang1.6-src/blob/839acbdcc4a83380e9e9cdb1e1140afd26980242/src/net/dnsclient_unix.go#L459-L480)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.
> range-loop variable fqdn used in defer or goroutine at line 462
[Click here to see the code in its original context.](https://github.com/wenfang/golang1.6-src/blob/839acbdcc4a83380e9e9cdb1e1140afd26980242/src/net/dnsclient_unix.go#L459-L480)
Click here to show the 22 line(s) of Go which triggered the analyzer.
```go
for _, fqdn := range conf.nameList(name) {
for _, qtype := range qtypes {
go func(qtype uint16) {
_, rrs, err := tryOneName(conf, fqdn, qtype)
lane <- racer{fqdn, rrs, err}
}(qtype)
}
for range qtypes {
racer := <-lane
if racer.error != nil {
// Prefer error for original name.
if lastErr == nil || racer.fqdn == name+"." {
lastErr = racer.error
}
continue
}
addrs = append(addrs, addrRecordList(racer.rrs)...)
}
if len(addrs) > 0 {
break
}
}
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: 839acbdcc4a83380e9e9cdb1e1140afd26980242
Contributor guide
No contributing guide indexed for this repository
Research direction
Read src/net/dnsclient_unix.go around lines 459-480 and inspect how the goroutine uses the range variable fqdn during DNS lookup. Compare that behavior with the issue’s analyzer report and the linked classification guidance. Done means leaving a reaction marking the finding as a bug, mitigated, or desirable behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100