Skip to content

sftp: NULL fName after free in all readdir variants#978

Merged
padelsbach merged 1 commit into
wolfSSL:masterfrom
ejohnstown:name-free
May 13, 2026
Merged

sftp: NULL fName after free in all readdir variants#978
padelsbach merged 1 commit into
wolfSSL:masterfrom
ejohnstown:name-free

Conversation

@ejohnstown
Copy link
Copy Markdown
Contributor

  • Apply the prior FATFS fix across Nucleus, MQX, Windows, Zephyr, Harmony, and user-filesystem readdir paths.
  • Prevents double-free crash when SFTPNAME_free runs on a name struct after readdir returns an error.

Follow up to PR #973.

- Apply the prior FATFS fix across Nucleus, MQX, Windows,
  Zephyr, Harmony, and user-filesystem readdir paths.
- Prevents double-free crash when SFTPNAME_free runs on a
  name struct after readdir returns an error.
Copilot AI review requested due to automatic review settings May 13, 2026 21:16
@ejohnstown ejohnstown self-assigned this May 13, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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 expands the SFTP readdir error-cleanup fix by clearing out->fName after freeing it in several filesystem-specific implementations, preventing later cleanup from double-freeing the same pointer.

Changes:

  • Adds out->fName = NULL after error-path frees in user-filesystem, Nucleus, MQX, Windows, Zephyr, Harmony, and default POSIX-style readdir paths.
  • Keeps the existing SFTP name allocation and long-name creation flow unchanged.

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

Comment thread src/wolfsftp.c
Copy link
Copy Markdown

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-bot left a comment

Choose a reason for hiding this comment

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

Fenrir Automated Review — PR #978

Scan targets checked: wolfssh-bugs, wolfssh-src

No new issues found in the changed files. ✅

@ejohnstown ejohnstown assigned wolfSSL-Bot and unassigned ejohnstown May 13, 2026
@padelsbach padelsbach merged commit 4b948e6 into wolfSSL:master May 13, 2026
135 checks passed
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.

5 participants