From 99c49780fdc3146d9ee708d04db0d4185b2df5c3 Mon Sep 17 00:00:00 2001 From: Sinspired <63581268+sinspired@users.noreply.github.com> Date: Thu, 27 Aug 2026 01:38:13 +0900 Subject: [PATCH] fix: prevent nil pointer dereference in WireGuard initialization (#3148) --- adapter/outbound/wireguard.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/adapter/outbound/wireguard.go b/adapter/outbound/wireguard.go index 53f7cadf6..10c8a260b 100644 --- a/adapter/outbound/wireguard.go +++ b/adapter/outbound/wireguard.go @@ -386,6 +386,10 @@ func NewWireGuard(option WireGuardOption) (*WireGuard, error) { } outbound.bind = wireguard.NewClientBind(context.Background(), wgSingErrorHandler{outbound.Name()}, singDialer, isConnect, outbound.connectAddr.AddrPort(), reserved) + if outbound.bind == nil { + return nil, E.New("failed to create wireguard client bind") + } + var err error outbound.localPrefixes, err = option.Prefixes() if err != nil {