Repository navigation
sftp: handle an empty request path - #1403
Open
ejohnstown wants to merge 2 commits into
Open
ejohnstown wants to merge 2 commits into
ejohnstown wants to merge 2 commits into
Conversation
GetStringRef() returns a NULL pointer for a zero-length string, and wolfSSH_SFTP_RecvRealPath() and GetAndCleanPath() passed it straight to memcpy(). That is undefined even for a length of 0. Copy only when the path has bytes; an empty path still resolves to the start path. - regress: REALPATH, STAT and LSTAT with an empty path, which UBSan flags at both copies without the guard Issue: wolfSSL#1400
An empty path resolves to the session's start directory, so RMDIR "" removed it when it was empty and answered OK. Refuse an empty path, or one that starts with NUL, with NO_SUCH_FILE and remove nothing, as OpenSSH's sftp-server does. - regress: REALPATH of an empty path names the start path Issue: wolfSSL#1400
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #1403
Scan targets checked: wolfssh-src, wolfssh-bugs
Coverage: 2 of 2 in-scope changed file(s) opened by the reviewer
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
Review tier: Max
Contributor
Author
|
@claude review |
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.
An empty SFTP path arrives as a NULL pointer, and REALPATH and every request
through GetAndCleanPath() passed it to memcpy(), which is undefined even for a
length of 0. RMDIR of an empty path also removed the start directory.
start path
OpenSSH does
Issue: #1400