Skip to content

Fix ssh->fs reference in Nucleus/Harmony SFTP_GetAttributes helpers#1082

Merged
ejohnstown merged 1 commit into
wolfSSL:masterfrom
yosuke-wolfssl:fix/f_6691
Jul 6, 2026
Merged

Fix ssh->fs reference in Nucleus/Harmony SFTP_GetAttributes helpers#1082
ejohnstown merged 1 commit into
wolfSSL:masterfrom
yosuke-wolfssl:fix/f_6691

Conversation

@yosuke-wolfssl

Copy link
Copy Markdown
Contributor

Overview

Fixes two copy/paste-style defects in src/wolfsftp.c where SFTP attribute
helpers referenced ssh->fs in a WSTAT/WLSTAT call, but the enclosing
function has no ssh variable in scope — only the filesystem handle the caller
already holds.

  • 6691 — Nucleus (WOLFSSL_NUCLEUS) SFTP_GetAttributes
  • 6692 — Harmony (MICROCHIP_MPLAB_HARMONY) SFTP_GetAttributesHelper

Changes

Nucleus SFTP_GetAttributes (6691)fs is already a parameter; use it:

    if (noFollow) {
        ret = WLSTAT(fs, fileName, &stats);
    }
    else {
        ret = WSTAT(fs, fileName, &stats);
    }

Harmony SFTP_GetAttributesHelper (6692) — the helper had no fs in scope,
so thread it through from both callers:

  • Added void* fs as the first parameter; WSTAT(fs, ...).
  • SFTP_GetAttributes(void* fs, ...) forwards fs.
  • SFTP_GetAttributes_Handle(WOLFSSH* ssh, ...) forwards ssh->fs (this
    function has ssh, not fs, in scope — ssh->fs is the correct in-scope
    access).

WOLFSSH_UNUSED(fs) is kept where the macro drops the handle, each with a short
comment explaining why fs still counts as unused despite appearing in the
WSTAT/WLSTAT call.

@yosuke-wolfssl yosuke-wolfssl self-assigned this Jul 6, 2026
Copilot AI review requested due to automatic review settings July 6, 2026 02:24

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

Fixes two platform-specific SFTP attribute helper implementations in src/wolfsftp.c that incorrectly referenced ssh->fs where ssh is not in scope, by consistently using (or threading through) the filesystem handle available in each call path.

Changes:

  • Nucleus (WOLFSSL_NUCLEUS): use the existing fs parameter in WSTAT/WLSTAT instead of ssh->fs.
  • Harmony (MICROCHIP_MPLAB_HARMONY): add fs to SFTP_GetAttributesHelper(...) and forward it from both SFTP_GetAttributes(...) and SFTP_GetAttributes_Handle(...) (using ssh->fs where appropriate).
  • Add clarifying comments and retain WOLFSSH_UNUSED(fs) where the port macros intentionally drop the fs argument.

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

@wolfSSL-Fenrir-bot wolfSSL-Fenrir-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.

Fenrir Automated Review — PR #1082

Scan targets checked: wolfssh-bugs, wolfssh-src

No new issues found in the changed files. ✅

@ejohnstown ejohnstown merged commit 09cbe92 into wolfSSL:master Jul 6, 2026
137 checks passed
@yosuke-wolfssl yosuke-wolfssl deleted the fix/f_6691 branch July 7, 2026 22:47
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