wgengine/magicsock: validate endpoint.derpAddr in Conn.onUDPRelayAllocResp (#17828)

Otherwise a zero value will panic in Conn.sendUDPStd.

Updates #17827

Signed-off-by: Jordan Whited <jordan@tailscale.com>
This commit is contained in:
Jordan Whited 2025-11-10 20:07:33 -08:00 committed by GitHub
parent 4650061326
commit 18806de400
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -651,8 +651,10 @@ func (c *Conn) onUDPRelayAllocResp(allocResp UDPRelayAllocResp) {
ep.mu.Lock() ep.mu.Lock()
defer ep.mu.Unlock() defer ep.mu.Unlock()
derpAddr := ep.derpAddr derpAddr := ep.derpAddr
if derpAddr.IsValid() {
go c.sendDiscoMessage(epAddr{ap: derpAddr}, ep.publicKey, disco.key, allocResp.Message, discoVerboseLog) go c.sendDiscoMessage(epAddr{ap: derpAddr}, ep.publicKey, disco.key, allocResp.Message, discoVerboseLog)
} }
}
// Synchronize waits for all [eventbus] events published // Synchronize waits for all [eventbus] events published
// prior to this call to be processed by the receiver. // prior to this call to be processed by the receiver.