SFTP Paths

1. Modify the SFTP function RecvOpen() to use the same path cleanup
   function, GetAndCleanPath(), that all the other SFTP functions use.
pull/867/head
John Safranek 2026-01-12 15:29:44 -08:00
parent fa648eccd0
commit 5cd4443e48
1 changed files with 5 additions and 7 deletions

View File

@ -2001,7 +2001,7 @@ int wolfSSH_SFTP_RecvOpen(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
{
WS_SFTP_FILEATRB atr;
WFD fd;
word32 sz, dirSz;
word32 sz;
char dir[WOLFSSH_MAX_FILENAME];
word32 reason;
word32 idx = 0;
@ -2043,9 +2043,8 @@ int wolfSSH_SFTP_RecvOpen(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
return WS_BUFFER_E;
}
dirSz = sizeof(dir);
if (wolfSSH_GetPath(ssh->sftpDefaultPath, data + idx, sz, dir, &dirSz)
!= WS_SUCCESS) {
if (GetAndCleanPath(ssh->sftpDefaultPath,
data + idx, sz, dir, sizeof(dir)) != WS_SUCCESS) {
WLOG(WS_LOG_SFTP, "Creating path for file to open failed");
return WS_FATAL_ERROR;
}
@ -2202,7 +2201,7 @@ int wolfSSH_SFTP_RecvOpen(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
{
/* WS_SFTP_FILEATRB atr;*/
HANDLE fileHandle;
word32 sz, dirSz;
word32 sz;
char dir[WOLFSSH_MAX_FILENAME];
word32 reason;
word32 idx = 0;
@ -2239,8 +2238,7 @@ int wolfSSH_SFTP_RecvOpen(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
return WS_BUFFER_E;
}
dirSz = sizeof(dir);
if (wolfSSH_GetPath(ssh->sftpDefaultPath, data + idx, sz, dir, &dirSz)
if (GetAndCleanPath(ssh->sftpDefaultPath, data + idx, sz, dir, sizeof(dir))
!= WS_SUCCESS) {
WLOG(WS_LOG_SFTP, "Creating path for file to open failed");
return WS_FATAL_ERROR;