mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-25 22:26:42 +00:00
Merge pull request #12 from roseteromeo56/alert-autofix-9
Potential fix for code scanning alert no. 9: Incorrect conversion between integer types
This commit is contained in:
commit
73a8af0c4c
2 changed files with 5 additions and 1 deletions
|
|
@ -336,7 +336,7 @@ func parseExtAddr(spec string) (ip net.IP, port int, ok bool) {
|
||||||
return nil, 0, false
|
return nil, 0, false
|
||||||
}
|
}
|
||||||
port, err = strconv.Atoi(portstr)
|
port, err = strconv.Atoi(portstr)
|
||||||
if err != nil {
|
if err != nil || port < 0 || port > 65535 {
|
||||||
return nil, 0, false
|
return nil, 0, false
|
||||||
}
|
}
|
||||||
return ip, port, true
|
return ip, port, true
|
||||||
|
|
|
||||||
|
|
@ -205,6 +205,10 @@ func (ln *LocalNode) SetFallbackIP(ip net.IP) {
|
||||||
// SetFallbackUDP sets the last-resort UDP-on-IPv4 port. This port is used
|
// SetFallbackUDP sets the last-resort UDP-on-IPv4 port. This port is used
|
||||||
// if no endpoint prediction can be made.
|
// if no endpoint prediction can be made.
|
||||||
func (ln *LocalNode) SetFallbackUDP(port int) {
|
func (ln *LocalNode) SetFallbackUDP(port int) {
|
||||||
|
if port < 0 || port > 65535 {
|
||||||
|
log.Error("Invalid port value, must be in range 0-65535", "port", port)
|
||||||
|
return
|
||||||
|
}
|
||||||
ln.mu.Lock()
|
ln.mu.Lock()
|
||||||
defer ln.mu.Unlock()
|
defer ln.mu.Unlock()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue