Skip to content

selector: avoid nil deref when no outbound is selected#4102

Open
SAY-5 wants to merge 105 commits into
SagerNet:testingfrom
SAY-5:say5/selector-nil-selected-3917
Open

selector: avoid nil deref when no outbound is selected#4102
SAY-5 wants to merge 105 commits into
SagerNet:testingfrom
SAY-5:say5/selector-nil-selected-3917

Conversation

@SAY-5

@SAY-5 SAY-5 commented May 2, 2026

Copy link
Copy Markdown

Fixes #3917.

Selector.DialContext/ListenPacket/NewConnection/NewPacketConnection/NewDirectRouteConnection all called s.selected.Load() and immediately dereferenced the result. Network() and Now() already nil-check; the connection-side methods didn't. After SFA disconnect+reconnect, selected can be nil and the next dial panics, guard each callsite.

@nekohasekai nekohasekai force-pushed the testing branch 2 times, most recently from 8f15b13 to 9ee56ae Compare May 3, 2026 01:08
@nekohasekai nekohasekai force-pushed the testing branch 3 times, most recently from 1b75d75 to 056c45c Compare May 11, 2026 16:12
…l-selected-3917

Signed-off-by: Sai Asish Y <say.apm35@gmail.com>

# Conflicts:
#	docs/changelog.md
@nekohasekai nekohasekai force-pushed the testing branch 3 times, most recently from de161cf to 83b7304 Compare June 3, 2026 05:05
@nekohasekai nekohasekai force-pushed the testing branch 7 times, most recently from 1ed57eb to 8247670 Compare June 13, 2026 15:01
@nekohasekai nekohasekai force-pushed the testing branch 6 times, most recently from 8ea55ff to a9fe3f3 Compare June 17, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Selector outbound causes nil pointer panic on reconnect when used as Tailscale endpoint detour (SFA)

3 participants