github-vet / github-vet/rangeloop-pointer-findings
Vincoll/vigie: pkg/probe/port/portfunc.go; 12 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [Vincoll/vigie](https://www.github.com/Vincoll/vigie) at [pkg/probe/port/portfunc.go](https://github.com/Vincoll/vigie/blob/24706fe588dcac28076988bf4fa367e66863beb6/pkg/probe/port/portfunc.go#L39-L50)
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 hp used in defer or goroutine at line 42
[Click here to see the code in its original context.](https://github.com/Vincoll/vigie/blob/24706fe588dcac28076988bf4fa367e66863beb6/pkg/probe/port/portfunc.go#L39-L50)
Click here to show the 12 line(s) of Go which triggered the analyzer.
```go
for i, hp := range addrsPort {
go func() {
pa, errReq := sendPortRequest(hp, p.Protocol, timeout)
if errReq != nil {
pi := probe.ProbeInfo{Status: probe.Error, Error: errReq.Error()}
pa = ProbeAnswer{Reachable: false, ProbeInfo: pi}
}
probeAnswers[i] = &pa
wg.Done()
}()
}
```
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: 24706fe588dcac28076988bf4fa367e66863beb6
Contributor guide
No contributing guide indexed for this repository
Research direction
Open pkg/probe/port/portfunc.go around lines 39-50 and inspect how the goroutine uses the range variables hp and i. Read the surrounding probing code and check whether concurrent execution can produce incorrect addresses or result indexes. Classify the finding with the appropriate reaction based on the observed 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
- Mostly clear
- Newbie friendliness
- 45/100