Skip to content

Fix nil pointer dereference in adrules api#5749

Open
WASDetchan wants to merge 3 commits intoXTLS:mainfrom
WASDetchan:main
Open

Fix nil pointer dereference in adrules api#5749
WASDetchan wants to merge 3 commits intoXTLS:mainfrom
WASDetchan:main

Conversation

@WASDetchan
Copy link

See issue #5748. Closes issue #5748.
Previous behavior:

$ ./xray api adrules -s=127.0.0.1:8080 empty_routing.json
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x11330dc]

goroutine 1 [running]:
github.com/xtls/xray-core/main/commands/all/api.executeAddRules(0x2271c80, {0x2557ff0ca030, 0x2, 0x2})
	github.com/xtls/xray-core/main/commands/all/api/rules_add.go:66 +0x3dc
github.com/xtls/xray-core/main/commands/base.Execute()
	github.com/xtls/xray-core/main/commands/base/execute.go:64 +0x59f
main.main()
	github.com/xtls/xray-core/main/main.go:22 +0x1a5

New behavior:

$ ./xray api adrules -s=127.0.0.1:8080 ../empty_routing.json
failed to add routing rule: config did not have "routing" field

Copilot AI added a commit to odlev/Xray-core that referenced this pull request Mar 6, 2026
Co-authored-by: odlev <65655276+odlev@users.noreply.github.com>
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.

2 participants