Skip to content

imap: check buffer length before accessing it - #19887

Closed
bagder wants to merge 2 commits into
masterfrom
bagder/imap-len
Closed

imap: check buffer length before accessing it#19887
bagder wants to merge 2 commits into
masterfrom
bagder/imap-len

Conversation

@bagder

@bagder bagder commented Dec 9, 2025

Copy link
Copy Markdown
Member

Pointed out by ZeroPath

@github-actions github-actions Bot added the IMAP label Dec 9, 2025
@bagder
bagder marked this pull request as ready for review December 9, 2025 09:06
@bagder
bagder requested a review from Copilot December 9, 2025 09:29
@bagder

bagder commented Dec 9, 2025

Copy link
Copy Markdown
Member Author

augment review

@augmentcode augmentcode Bot 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.

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

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 adds a buffer length check before accessing buffer data at an offset in the IMAP SELECT response handler. The change prevents potential out-of-bounds memory access when parsing UIDVALIDITY responses from IMAP servers by verifying the buffer length before accessing line[2]. This is a security fix pointed out by ZeroPath.

Key Changes:

  • Moved buffer pointer and length retrieval to be scoped within the condition where they're used
  • Added length check (len > 2) before accessing buffer at offset 2

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

Comment thread lib/imap.c Outdated
Comment thread lib/imap.c Outdated
@bagder bagder closed this in 43c781a Dec 9, 2025
@bagder
bagder deleted the bagder/imap-len branch December 9, 2025 09:51
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