forked from alliedmodders/sourcemod
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix invalid client index in Basebans menu
Fix alliedmodders#1768 The `sm_admin`-triggered Menu flow for banning players is caching client indices inside the basebans.sp `PlayerInfo` struct, and can then incorrectly use them in the menu callback without checking for the related client's UserId validity. This leads to bug alliedmodders#1768 occurring when the ban target player disconnects from the server before the banning admin could complete the banmenu UI flow. Since the related menu callbacks can't rely on the cached client index, I have removed the basebans.sp `PlayerInfo.banTarget` member entirely, in favor of the `PlayerInfo.banTarget`, and instead call `GetClientOfUserId(...)` to get & validate the target client index where necessary. The `PrepareBan(...)` function has been refactored to take a ban target UserId (instead of the target client index) accordingly.
- Loading branch information
Showing
2 changed files
with
47 additions
and
31 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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