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 <[email protected]>
(cherry picked from commit 18806de400)
This commit is contained in:
Jordan Whited authored and Jordan Whited committed 2025-11-15 13:54:07 -08:00
1 parent 28f6c2dbfc
commit e602907cf5
1 file changed
+3 -1
+3 -1
View File
@@ -651,7 +651,9 @@ func (c *Conn) onUDPRelayAllocResp(allocResp UDPRelayAllocResp) {
ep.mu.Lock()
defer ep.mu.Unlock()
derpAddr := ep.derpAddr
go c.sendDiscoMessage(epAddr{ap: derpAddr}, ep.publicKey, disco.key, allocResp.Message, discoVerboseLog)
if derpAddr.IsValid() {
go c.sendDiscoMessage(epAddr{ap: derpAddr}, ep.publicKey, disco.key, allocResp.Message, discoVerboseLog)
}
}
// Synchronize waits for all [eventbus] events published