github-vet / github-vet/rangeloop-pointer-findings

ivpn/desktop-app-cli: commands/connection.go; 35 LoC

Open
#14,862 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [ivpn/desktop-app-cli](https://www.github.com/ivpn/desktop-app-cli) at [commands/connection.go](https://github.com/ivpn/desktop-app-cli/blob/d25a94743be131f0f15dd4a229fea929f8151690/commands/connection.go#L443-L477)

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.

> reference to s is reassigned at line 445

[Click here to see the code in its original context.](https://github.com/ivpn/desktop-app-cli/blob/d25a94743be131f0f15dd4a229fea929f8151690/commands/connection.go#L443-L477)

Click here to show the 35 line(s) of Go which triggered the analyzer.

```go
for _, s := range servers.OpenvpnServers {
if s.Gateway == c.gateway {
entrySvr = &s
// TODO: obfsproxy configuration for this connection must be sent in 'Connect' request (avoid using daemon preferences)
if err = _proto.SetPreferences("enable_obfsproxy", fmt.Sprint(c.obfsproxy)); err != nil {
return err
}

serverFound = true
req.VpnType = vpn.OpenVPN
req.OpenVpnParameters.EntryVpnServer.IPAddresses = s.IPAddresses

// port
destPort, err = getPort(vpn.OpenVPN, c.port)
if err != nil {
return err
}
req.OpenVpnParameters.Port.Port = destPort.port
req.OpenVpnParameters.Port.Protocol = destPort.IsTCP()

if len(c.multihopExitSvr) > 0 {
// get Multi-Hop ID
req.OpenVpnParameters.MultihopExitSrvID = strings.Split(c.multihopExitSvr, ".")[0]
}
break
}
if len(c.multihopExitSvr) == 0 {
if entrySvr != nil {
break
}
if entrySvr != nil && exitSvr != nil {
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: d25a94743be131f0f15dd4a229fea929f8151690

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.