Skip to content

Fix SIGSEGV in /frm config on dedicated servers - #300

Open
coredmp95 wants to merge 1 commit into
porisius:devfrom
coredmp95:fix/frm-config-dedicated-server-sigsegv
Open

Fix SIGSEGV in /frm config on dedicated servers#300
coredmp95 wants to merge 1 commit into
porisius:devfrom
coredmp95:fix/frm-config-dedicated-server-sigsegv

Conversation

@coredmp95

Copy link
Copy Markdown

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, the Cast yields null, and GetDSPrivilegeLevel() (a FORCEINLINE member 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-side AFGPlayerController, so use it directly instead of the GetControlledCharacter()->GetLocalViewingPlayerController() detour.
  • Null-guard the controller: a null (console / non-player) sender is treated as trusted, and the privilege check short-circuits before GetNetMode() is ever called on a null pointer.
  • Add the missing early return so 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

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.
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.

1 participant