diff options
| author | Nick Khyl <nickk@tailscale.com> | 2025-04-23 09:35:14 -0500 |
|---|---|---|
| committer | Nick Khyl <1761190+nickkhyl@users.noreply.github.com> | 2025-04-23 09:41:44 -0500 |
| commit | c41a2d5c8372cea8bf5dc64ed8fcbec577fc00fd (patch) | |
| tree | 65df2adf842973ed02a17f8a5205c88e0e917986 | |
| parent | c28fda864a3a6f9f563f34d6ae90f6dd09784d05 (diff) | |
| download | tailscale-c41a2d5c8372cea8bf5dc64ed8fcbec577fc00fd.tar.xz tailscale-c41a2d5c8372cea8bf5dc64ed8fcbec577fc00fd.zip | |
net/portmapper: fix nil pointer dereference in Client.createMapping
The EventBus in net/portmapper.Config is still optional and Client.updates can be nil.
Updates #15772
Signed-off-by: Nick Khyl <nickk@tailscale.com>
| -rw-r--r-- | net/portmapper/portmapper.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/net/portmapper/portmapper.go b/net/portmapper/portmapper.go index f95d6503a..59f88e966 100644 --- a/net/portmapper/portmapper.go +++ b/net/portmapper/portmapper.go @@ -508,11 +508,13 @@ func (c *Client) createMapping() { } return } - c.updates.Publish(Mapping{ - External: mapping.External(), - Type: mapping.MappingType(), - GoodUntil: mapping.GoodUntil(), - }) + if c.updates != nil { + c.updates.Publish(Mapping{ + External: mapping.External(), + Type: mapping.MappingType(), + GoodUntil: mapping.GoodUntil(), + }) + } if c.onChange != nil { go c.onChange() } |
