Skip to content

Commit

Permalink
ipn/wg: index out of range in wgconn
Browse files Browse the repository at this point in the history
  • Loading branch information
ignoramous committed Nov 16, 2024
1 parent 1ac29ee commit 0cc6604
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions intra/ipn/wg/wgconn.go
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,16 @@ func (s *StdNetBind) flood(c *net.UDPConn, dst netip.AddrPort, why floodkind) (i
}

func isReservedOverwitten(b []byte) bool {
return useWarpClientID && len(b) == 3 &&
(b[1] != 0 || b[2] != 0 || b[3] != 0)
if !useWarpClientID {
return false
}

if n := len(b); n == 3 { // client-id
return b[0] != 0 || b[1] != 0 || b[2] != 0
} else if n > 3 { // wg message
return b[1] != 0 || b[2] != 0 || b[3] != 0
}
return false
}

func (s *StdNetBind) BatchSize() int {
Expand Down

1 comment on commit 0cc6604

@ignoramous
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.