tailscale / tailscale

The easiest, most secure way to use WireGuard and 2FA.
https://tailscale.com
BSD 3-Clause "New" or "Revised" License
16.89k stars 1.28k forks source link

ipn/ipnlocal: fix null dereference for early suggested exit node queries #11885

Closed barnstar closed 3 weeks ago

barnstar commented 3 weeks ago

Fixes tailscale/corp#19558

A request for the suggested exit nodes that occurs too early in the VPN lifecycle would result in a null deref of the netmap and/or the netcheck report. This checks both and errors out.

clairew commented 3 weeks ago

just noticed that in GetLastNetcheckReport - report checks if the lastNetcheckReport is nil, and if it is, gets another report. I was trying to write a test for a nil netcheck report case, and the test was failing due to this.

Maybe just check if nil netmap?