github-vet / github-vet/rangeloop-pointer-findings
zmap/zgrab2: processing.go; 22 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [zmap/zgrab2](https://www.github.com/zmap/zgrab2) at [processing.go](https://github.com/zmap/zgrab2/blob/3613392bf090b55df3725896155c9efaf22db435/processing.go#L155-L176)
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 scannerName used in defer or goroutine at line 163
[Click here to see the code in its original context.](https://github.com/zmap/zgrab2/blob/3613392bf090b55df3725896155c9efaf22db435/processing.go#L155-L176)
Click here to show the 22 line(s) of Go which triggered the analyzer.
```go
for _, scannerName := range orderedScanners {
scanner := scanners[scannerName]
trigger := (*scanner).GetTrigger()
if input.Tag != trigger {
continue
}
defer func(name string) {
if e := recover(); e != nil {
log.Errorf("Panic on scanner %s when scanning target %s: %#v", scannerName, input.String(), e)
// Bubble out original error (with original stack) in lieu of explicitly logging the stack / error
panic(e)
}
}(scannerName)
name, res := RunScanner(*scanner, m, input)
moduleResult[name] = res
if res.Error != nil && !config.Multiple.ContinueOnError {
break
}
if res.Status == SCAN_SUCCESS && config.Multiple.BreakOnSuccess {
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: 3613392bf090b55df3725896155c9efaf22db435
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading processing.go lines 155-176 at commit 3613392bf090b55df3725896155c9efaf22db435, focusing on the scanner loop and deferred recovery handler. Check the analyzer warning and surrounding scanner-processing behavior. Done means the reported range-loop issue is addressed without changing the intended panic logging and recovery 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
- 52/100