Skip to content

Add a bounds check on ff_close, ff_pwrite and ff_pread#904

Merged
dgarske merged 1 commit into
wolfSSL:masterfrom
yosuke-wolfssl:f_1272
Apr 8, 2026
Merged

Add a bounds check on ff_close, ff_pwrite and ff_pread#904
dgarske merged 1 commit into
wolfSSL:masterfrom
yosuke-wolfssl:f_1272

Conversation

@yosuke-wolfssl

Copy link
Copy Markdown
Contributor

This PR adds the bound check into ff_close, ff_pwrite and ff_pread implemented in src/wolfsftp.c.

@yosuke-wolfssl yosuke-wolfssl self-assigned this Apr 2, 2026
Copilot AI review requested due to automatic review settings April 2, 2026 23:08

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

Adds defensive bounds checks for FatFS-backed file descriptor pool access to prevent out-of-range indexing in the WolfSSH SFTP FatFS port.

Changes:

  • Add fd range validation in ff_close.
  • Add fd range validation in ff_pwrite / ff_pread before dereferencing fd_pool[fd].
  • Refactor FIL* f initialization so it occurs after the new bounds checks.

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

@dgarske
dgarske merged commit a0e501b into wolfSSL:master Apr 8, 2026
135 checks passed
@yosuke-wolfssl
yosuke-wolfssl deleted the f_1272 branch April 16, 2026 05:57
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