security check: int32 with size_t mixed calc on memcpy parameter#35218
security check: int32 with size_t mixed calc on memcpy parameter#35218DuanKuanJun wants to merge 3 commits intomainfrom
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a bounds check in uvConnMayGetUserInfo to ensure the message length is sufficient before allocating memory for user information, preventing potential issues with len - offset. The reviewer suggested storing the calculated required length in a variable to improve code readability and eliminate redundant calculations.
There was a problem hiding this comment.
Pull request overview
This PR hardens server-side transport message handling by validating packet length before extracting embedded user/token info, preventing unsafe size calculations during buffer copies.
Changes:
- Add a minimum-length check when
withUserInfois set to ensure the message contains the required header + user/token bytes before copying. - Log an error and abort user-info extraction when the packet is too short.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
Issue(s)
Checklist
Please check the items in the checklist if applicable.