Fix SIGSEGV in /frm config on dedicated servers - #300
Open
coredmp95 wants to merge 1 commit into
Open
Conversation
The `/frm config` chat command resolved the calling player's controller via Sender->GetPlayer()->GetControlledCharacter()->GetLocalViewingPlayerController(). On a dedicated server there is no local viewing player controller, so that chain returns null and the following GetDSPrivilegeLevel() call dereferences it, crashing the server (SIGSEGV) on any /frm config invocation. UCommandSender::GetPlayer() already returns the sender's server-side AFGPlayerController, so use it directly and null-guard it (a null/console sender is treated as trusted). Also add the missing early return so a player without sufficient privileges no longer falls through and applies the setting anyway.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
/frm config <setting> <value>crashes a dedicated server with a SIGSEGV on any invocation (any setting, any value).The command resolves the calling player's controller with:
AFGPlayerController* PlayerController = Cast<AFGPlayerController>( Sender->GetPlayer()->GetControlledCharacter()->GetLocalViewingPlayerController()); EPrivilegeLevel PrivilegeLevel = PlayerController->GetDSPrivilegeLevel();On a dedicated server there is no local viewing player controller, so
GetLocalViewingPlayerController()returns null, theCastyields null, andGetDSPrivilegeLevel()(aFORCEINLINEmember read) dereferences it →SIGSEGV: invalid attempt to read memory at address 0x...09d0.Reproduction: run
/frm config uWS.Port 8080(or any key) from an admin client on a dedicated server → server crashes.Fix
UCommandSender::GetPlayer()already returns the sender's server-sideAFGPlayerController, so use it directly instead of theGetControlledCharacter()->GetLocalViewingPlayerController()detour.GetNetMode()is ever called on a null pointer.returnso a player without sufficient privileges no longer falls through and applies the setting anyway.One file changed, no behavioral change for authorized listen-server/standalone/admin callers.
🤖 Generated with Claude Code