Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit players when registering a server #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

rzaba0
Copy link

@rzaba0 rzaba0 commented Dec 22, 2024

In its current state, lobby doesn't impose a limit on the size of players list that is sent when registering a server. Considering that the lobby stores servers' information in memory, it can be abused to force the server to run out of memory.

This PR aims to address this issue by:

  1. Limiting MaxPlayers to 255, which seems to match soldank's implementation (soldier ids seem to be uint8)
  2. Validating the size of players list in the incoming JSON - size can't exceed the declared value of MaxPlayers

With these changes, memory consumption on successful server registration should be somewhat contained.

Copy link
Collaborator

@nedik nedik left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for working on this!

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