conn: fix getSrcFromControl() iteration

We only expect a single control message in the normal case, but this
would loop infinitely if there were more.

Reviewed-by: Adrian Dewhurst <adrian@tailscale.com>
Signed-off-by: Jordan Whited <jordan@tailscale.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jordan Whited
2023-03-14 20:28:07 -07:00
committed by Jason A. Donenfeld
parent fff53afca7
commit 07a1e55270
2 changed files with 29 additions and 1 deletions

View File

@@ -25,7 +25,7 @@ func getSrcFromControl(control []byte, ep *StdNetEndpoint) {
)
for len(rem) > unix.SizeofCmsghdr {
hdr, data, rem, err = unix.ParseOneSocketControlMessage(control)
hdr, data, rem, err = unix.ParseOneSocketControlMessage(rem)
if err != nil {
return
}