-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keep trailing delimiter with SFTP open #743
base: master
Are you sure you want to change the base?
Conversation
src/internal.c
Outdated
out[0] = '/'; | ||
curSz++; | ||
} | ||
out[curSz] = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sanity checks needed on curSz before use (thanks @douzzer )
if (!WOLFSSH_SFTP_IS_DELIM(out[0])) { | ||
if (curSz + 1 < *outSz) { | ||
WMEMMOVE(out+1, out, curSz); | ||
out[0] = '/'; | ||
} | ||
curSz++; | ||
} | ||
if (curSz < *outSz) { | ||
out[curSz] = 0; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, when *outSz
is to small to accommodate the shifted data with the terminating null, an error code should be returned, and checked for by callers.
ZD 18566
Fix for SFTP cases with trailing delimiter.
OpenSSH client 9.6 (which does a SFTP command instead of SCP, -O restores using SCP protocol)
Before this change wolfSSH would allow test.txt to be copied to /tmp/subfolder/test. After this change the command correctly fails.