Skip to content

fix STOC_CHAT, CTOS_CHAT handling#2836

Merged
salix5 merged 1 commit into
masterfrom
patch-chat
Jun 14, 2025
Merged

fix STOC_CHAT, CTOS_CHAT handling#2836
salix5 merged 1 commit into
masterfrom
patch-chat

Conversation

@salix5

@salix5 salix5 commented Jun 12, 2025

Copy link
Copy Markdown
Collaborator

No description provided.

@salix5 salix5 requested a review from Copilot June 12, 2025 04:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR replaces the check_msg_size helper with inline bounds checks for chat packet lengths in both server and client handlers, and removes the now-unused helper from network.h.

  • Remove check_msg_size from gframe/network.h
  • Add explicit size validations in NetServer::HandleCTOSPacket and DuelClient::HandleSTOCPacketLan
  • Remove helper call in NetServer::CreateChatPacket

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
gframe/network.h Deleted the check_msg_size inline function
gframe/netserver.cpp Replaced chat‐length helper with direct checks; removed helper use in CreateChatPacket
gframe/duelclient.cpp Added inline STOC_CHAT size validations; removed check_msg_size call
Comments suppressed due to low confidence (1)

gframe/netserver.cpp:368

  • Without a size check on src_size, this memcpy may overflow the src_msg buffer. Reintroduce a bounds check (e.g. ensure src_size <= LEN_CHAT_MSG * sizeof(uint16_t)) before copying.
std::memcpy(src_msg, src, src_size);

Comment thread gframe/netserver.cpp
Comment thread gframe/duelclient.cpp
@purerosefallen

Copy link
Copy Markdown
Collaborator

what did this PR actually do?

another descless one

@salix5

salix5 commented Jun 14, 2025

Copy link
Copy Markdown
Collaborator Author

This PR replaces the check_msg_size helper with inline bounds checks for chat packet lengths in both server and client handlers, and removes the now-unused helper from network.h.

  • Remove check_msg_size from gframe/network.h
  • Add explicit size validations in NetServer::HandleCTOSPacket and DuelClient::HandleSTOCPacketLan
  • Remove helper call in NetServer::CreateChatPacket

Short version:
simply the length check

@salix5 salix5 merged commit 456f275 into master Jun 14, 2025
8 checks passed
@salix5 salix5 deleted the patch-chat branch June 15, 2025 05:26
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.

4 participants