mirror of
https://github.com/netbirdio/netbird.git
synced 2026-05-20 07:39:56 +00:00
Reject out-of-range UDP port before narrowing to uint16 in fakeAddress
This commit is contained in:
@@ -203,6 +203,9 @@ func fakeAddress(peerAddress *net.UDPAddr) (*netip.AddrPort, error) {
|
|||||||
if peerAddress == nil {
|
if peerAddress == nil {
|
||||||
return nil, fmt.Errorf("nil peer address")
|
return nil, fmt.Errorf("nil peer address")
|
||||||
}
|
}
|
||||||
|
if peerAddress.Port < 0 || peerAddress.Port > 65535 {
|
||||||
|
return nil, fmt.Errorf("invalid UDP port: %d", peerAddress.Port)
|
||||||
|
}
|
||||||
|
|
||||||
addr, ok := netip.AddrFromSlice(peerAddress.IP)
|
addr, ok := netip.AddrFromSlice(peerAddress.IP)
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|||||||
Reference in New Issue
Block a user