Add small overhead for event size constraints - #5367
Merged
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
A moderate size-limit validation issue remains in CLuaEventPacket.cpp.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
Adds protocol headroom to Lua event size checks and hardens latent-transfer buffer validation.
Changes:
- Adds 64 KiB event envelope headroom.
- Enforces latent packet limits with safer bounds checks.
- Applies size validation across event handling paths.
File summaries
| File | Summary |
|---|---|
Shared/mods/deathmatch/logic/CLatentReceiver.cpp |
Updates latent packet limits and buffer validation. |
Server/mods/deathmatch/logic/packets/CLuaEventPacket.h |
Defines shared event headroom. |
Server/mods/deathmatch/logic/packets/CLuaEventPacket.cpp |
Applies event size validation; post-consumption headroom handling requires correction. |
Server/mods/deathmatch/logic/CGame.cpp |
Accounts for envelope overhead in incoming event checks. |
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
🟡 Changes recommended
Enforce the documented argument limit without adding envelope headroom to the payload-only check.
Get a fresh assessment by requesting another Copilot review.
Review details
- Files reviewed: 4/4 changed files
- Comments generated: 1
- Review effort level: Lite
| if (usNameLength < (MAX_EVENT_NAME_LENGTH - 1) && BitStream.ReadStringCharacters(m_strName, usNameLength) && BitStream.Read(m_ElementID)) | ||
| { | ||
| if (BitStream.GetNumberOfUnreadBits() > MAX_LUA_LATENT_EVENT_ARGUMENTS_SIZE * 8) | ||
| if (BitStream.GetNumberOfUnreadBits() > (MAX_LUA_LATENT_EVENT_ARGUMENTS_SIZE + LUA_EVENT_ENVELOPE_HEADROOM) * 8) |
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.
No description provided.