Skip to content

Validate all reads in CPlayerModInfoPacket::Read - #5561

Open
DrWellsy wants to merge 1 commit into
multitheftauto:masterfrom
DrWellsy:fix/modinfo-packet-validation
Open

DrWellsy wants to merge 1 commit into
multitheftauto:masterfrom
DrWellsy:fix/modinfo-packet-validation

Conversation

@DrWellsy

Copy link
Copy Markdown

Summary

Check every BitStream read inside the item loop in CPlayerModInfoPacket::Read, clear m_strInfoType and m_ModInfoItemList on entry/failure, and default-initialize the primitive fields in SModInfoItem.

Motivation

Previously only the final ReadString(item.strLongSha256) return value was checked. Malformed packets with invalid intermediate string lengths (leaving trailing bytes unread) or truncated reads could still pass Read() and forward partial or misaligned SModInfoItem data to onPlayerModInfo.

Test plan

Built Deathmatch (Release Win32) with no warnings in the modified files, verified formatting with clang-format, and tested valid round-trips plus malformed/truncated payload rejection using MockBitStream.

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

Only the final ReadString(strLongSha256) call was checked before, so malformed packets with invalid intermediate string lengths or truncated reads could still pass Read() and forward misaligned SModInfoItem data to onPlayerModInfo.

Check each BitStream read inside the item loop, reset packet state cleanly on entry/failure, and initialize primitive fields in SModInfoItem.
Copilot AI balanced review requested due to automatic review settings November 17, 2026 15:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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