Fix ssh->fs reference in Nucleus/Harmony SFTP_GetAttributes helpers#1082
Merged
Conversation
Contributor
There was a problem hiding this comment.
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 existingfsparameter inWSTAT/WLSTATinstead ofssh->fs. - Harmony (
MICROCHIP_MPLAB_HARMONY): addfstoSFTP_GetAttributesHelper(...)and forward it from bothSFTP_GetAttributes(...)andSFTP_GetAttributes_Handle(...)(usingssh->fswhere appropriate). - Add clarifying comments and retain
WOLFSSH_UNUSED(fs)where the port macros intentionally drop thefsargument.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1082
Scan targets checked: wolfssh-bugs, wolfssh-src
No new issues found in the changed files. ✅
ejohnstown
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Fixes two copy/paste-style defects in
src/wolfsftp.cwhere SFTP attributehelpers referenced
ssh->fsin aWSTAT/WLSTATcall, but the enclosingfunction has no
sshvariable in scope — only the filesystem handle the calleralready holds.
WOLFSSL_NUCLEUS)SFTP_GetAttributesMICROCHIP_MPLAB_HARMONY)SFTP_GetAttributesHelperChanges
Nucleus
SFTP_GetAttributes(6691) —fsis already a parameter; use it:Harmony
SFTP_GetAttributesHelper(6692) — the helper had nofsin scope,so thread it through from both callers:
void* fsas the first parameter;WSTAT(fs, ...).SFTP_GetAttributes(void* fs, ...)forwardsfs.SFTP_GetAttributes_Handle(WOLFSSH* ssh, ...)forwardsssh->fs(thisfunction has
ssh, notfs, in scope —ssh->fsis the correct in-scopeaccess).
WOLFSSH_UNUSED(fs)is kept where the macro drops the handle, each with a shortcomment explaining why
fsstill counts as unused despite appearing in theWSTAT/WLSTATcall.