Skip to content

fix: format-string vulnerability in printAdminList - #39

Merged
Rushaway merged 2 commits into
masterfrom
fix/format-string-vulnerability
Sep 21, 2026
Merged

Rushaway merged 2 commits into
masterfrom
fix/format-string-vulnerability

Conversation

@Rushaway

Copy link
Copy Markdown
Member

Summary

  • printAdminList() passed a dynamically-built line — which can embed an admin's own display name — directly as CPrintToChat's format-string argument instead of as data.
  • A % character in that name (SourceMod doesn't filter these out of Steam display names) would be interpreted as a Format() directive with no corresponding argument, which can crash or garble sm_admins's output for everyone.
  • Fixed by passing it via "%s" instead.

Fixes #38.

Test plan

  • Compiled cleanly with the local SourcePawn compiler (no errors/warnings).

🤖 Generated with Claude Code

printAdminList() passed a dynamically-built string (which can embed an
admin's own display name, via GetClientName/GetClientNameOfAdminId) as
the format-string argument itself:

    CPrintToChat(client, resolvedAdminsAndGroups[i]);

If that string contains a '%' character (nothing stops an admin's Steam
display name from containing one), it gets interpreted as a Format()
directive instead of literal text, which can read past the (nonexistent)
variadic arguments and crash or garble the sm_admins output for every
viewer, not just the admin whose name triggered it.

Fixed by passing it as data instead: CPrintToChat(client, "%s", ...).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 20, 2026 13:19

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The focused change correctly prevents admin names containing % from being interpreted as format directives.

Review effort: Lite
Findings: None

What changed in this PR

Fixes a format-string vulnerability in printAdminList() by treating dynamic admin-list text as data.

Changes:

  • Passes resolved admin lines through %s when calling CPrintToChat.
File Description
addons/​sourcemod/​scripting/​AdvancedAdminList.sp Secures admin-list chat output formatting.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@Rushaway
Rushaway merged commit ee92b2b into master Sep 21, 2026
6 checks passed
@Rushaway
Rushaway deleted the fix/format-string-vulnerability branch September 21, 2026 09:28
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.

Format-string vulnerability in printAdminList (sm_admins)

2 participants