mirror of
https://github.com/netbirdio/netbird.git
synced 2026-05-14 04:39:54 +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 {
|
||||
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)
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user