Skip to content

Commit

Permalink
Fix code scanning alert no. 6: Incorrect conversion between integer t…
Browse files Browse the repository at this point in the history
…ypes

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
  • Loading branch information
tg123 and github-advanced-security[bot] authored Oct 24, 2024
1 parent da53065 commit 3493225
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion libplugin/skel.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ func (p *SkelPlugin) createUpstream(conn ConnMetadata, to SkelPipeTo) (*Upstream

return &Upstream{
Host: host,
Port: int32(port),
Port: int32(port), // port is already checked to be within int32 range in SplitHostPortForSSH
UserName: user,
IgnoreHostKey: to.IgnoreHostKey(conn),
}, err
Expand Down
4 changes: 2 additions & 2 deletions libplugin/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,11 @@ func SplitHostPortForSSH(addr string) (host string, port int, err error) {
h, p, err := net.SplitHostPort(host)
if err == nil {
host = h
port, err = strconv.Atoi(p)

parsedPort, err := strconv.ParseInt(p, 10, 32)

Check failure on line 70 in libplugin/util.go

View workflow job for this annotation

GitHub Actions / Build

inner declaration of var err error
if err != nil {
return

Check failure on line 72 in libplugin/util.go

View workflow job for this annotation

GitHub Actions / Build

result parameter err not in scope at return
}
port = int(parsedPort)
} else if host != "" {
// test valid after concat :22
if _, _, err = net.SplitHostPort(host + ":22"); err == nil {
Expand Down

0 comments on commit 3493225

Please sign in to comment.