Skip to content

fix(filters): prevent array out-of-bounds access#23

Merged
oylsister merged 1 commit intooylsister:mainfrom
Rushaway:3.6.6
Jun 17, 2025
Merged

fix(filters): prevent array out-of-bounds access#23
oylsister merged 1 commit intooylsister:mainfrom
Rushaway:3.6.6

Conversation

@Rushaway
Copy link
Copy Markdown
Contributor

@Rushaway Rushaway commented Jun 6, 2025

Description

This PR fixes potential array out-of-bounds access in the leader filter functions.
The issue occurred when trying to access g_iCurrentLeader array with client indices that could be larger than the array size.

Changes

  • Added proper bounds checking in all filter functions:
    • Filter_Leaders
    • Filter_NotLeaders
    • Filter_Leader
    • Filter_NotLeader
  • Standardized array bounds checking using MAXLEADER constant
  • Improved safety by handling client indices >= MAXLEADER appropriately

Technical Details

  • The g_iCurrentLeader array is sized to MAXLEADER
  • Client indices can go up to MaxClients
  • Added checks to prevent accessing the array with invalid indices
  • For indices >= MAXLEADER, clients are considered "not leaders" by default

Testing

  • Verified all filter functions work correctly with client indices
  • Confirmed no array out-of-bounds errors occur
  • Tested with various client indices including edge cases

@oylsister oylsister merged commit 9634524 into oylsister:main Jun 17, 2025
3 checks passed
@Rushaway Rushaway deleted the 3.6.6 branch June 17, 2025 08:43
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.

2 participants