Skip to content

Commit 63f9ef2

Browse files
authored
chore: fix minor int coercion codeql vulnerability (#7024)
1 parent c18ed61 commit 63f9ef2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

cli/agent.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,8 @@ func urlPort(u string) (int, error) {
336336
return -1, xerrors.Errorf("invalid url %q: %w", u, err)
337337
}
338338
if parsed.Port() != "" {
339-
port, err := strconv.ParseInt(parsed.Port(), 10, 64)
340-
if err == nil && port > 0 {
339+
port, err := strconv.ParseUint(parsed.Port(), 10, 16)
340+
if err == nil && port > 0 && port < 1<<16 {
341341
return int(port), nil
342342
}
343343
}

0 commit comments

Comments
 (0)