Repository navigation
fix: format-string vulnerability in printAdminList - #39
Merged
Merged
Conversation
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>
There was a problem hiding this comment.
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
%swhen callingCPrintToChat.
| 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.
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.
Summary
printAdminList()passed a dynamically-built line — which can embed an admin's own display name — directly asCPrintToChat's format-string argument instead of as data.%character in that name (SourceMod doesn't filter these out of Steam display names) would be interpreted as aFormat()directive with no corresponding argument, which can crash or garblesm_admins's output for everyone."%s"instead.Fixes #38.
Test plan
🤖 Generated with Claude Code