Skip to content

smb: integer overflow proof a size check#22001

Closed
bagder wants to merge 1 commit into
masterfrom
bagder/smb-integer
Closed

smb: integer overflow proof a size check#22001
bagder wants to merge 1 commit into
masterfrom
bagder/smb-integer

Conversation

@bagder

@bagder bagder commented Jun 14, 2026

Copy link
Copy Markdown
Member

By using size_t for the vars instead of shorts.

Pointed out by Zeropath

By using size_t for the vars instead of shorts.

Pointed out by Zeropath

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.

Pull request overview

This PR hardens SMB response parsing in lib/smb.c against integer-overflow bypasses in a packet size/bounds check by widening the temporary length/offset variables used in the calculation.

Changes:

  • Replace unsigned short temporaries with size_t for SMB response len/off values in smb_request_state().
  • Ensure the subsequent bounds arithmetic (off + sizeof(unsigned int) + len) is performed in a type wide enough to prevent 16-bit wraparound.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bagder bagder marked this pull request as ready for review June 14, 2026 16:12
@bagder bagder closed this in c4cb676 Jun 14, 2026
@bagder bagder deleted the bagder/smb-integer branch June 14, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants