wireguard-go icon indicating copy to clipboard operation
wireguard-go copied to clipboard

allowedips: Fix removeByPeer

Open damianhxy opened this issue 4 years ago • 0 comments

I have found what I believe to be a mistake in the implementation of removeByPeer.

Currently, it returns node.child[0] without checking if node.child[1] is nil, causing the loss of the right child if it was not nil. I have added a check to check if node.child[1] is nil before returning node.child[0]; otherwise, we return node.

The kernel implementation does not have this problem as it correctly checks for this scenario.

Signed-off-by: Damian Ho [email protected]

damianhxy avatar Mar 18 '21 13:03 damianhxy