Skip to content

Commit 8b83d63

Browse files
Merge pull request #867 from ejohnstown/paths
SFTP Paths
2 parents ef44b38 + 5cd4443 commit 8b83d63

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/wolfsftp.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,7 +2001,7 @@ int wolfSSH_SFTP_RecvOpen(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
20012001
{
20022002
WS_SFTP_FILEATRB atr;
20032003
WFD fd;
2004-
word32 sz, dirSz;
2004+
word32 sz;
20052005
char dir[WOLFSSH_MAX_FILENAME];
20062006
word32 reason;
20072007
word32 idx = 0;
@@ -2043,9 +2043,8 @@ int wolfSSH_SFTP_RecvOpen(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
20432043
return WS_BUFFER_E;
20442044
}
20452045

2046-
dirSz = sizeof(dir);
2047-
if (wolfSSH_GetPath(ssh->sftpDefaultPath, data + idx, sz, dir, &dirSz)
2048-
!= WS_SUCCESS) {
2046+
if (GetAndCleanPath(ssh->sftpDefaultPath,
2047+
data + idx, sz, dir, sizeof(dir)) != WS_SUCCESS) {
20492048
WLOG(WS_LOG_SFTP, "Creating path for file to open failed");
20502049
return WS_FATAL_ERROR;
20512050
}
@@ -2202,7 +2201,7 @@ int wolfSSH_SFTP_RecvOpen(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
22022201
{
22032202
/* WS_SFTP_FILEATRB atr;*/
22042203
HANDLE fileHandle;
2205-
word32 sz, dirSz;
2204+
word32 sz;
22062205
char dir[WOLFSSH_MAX_FILENAME];
22072206
word32 reason;
22082207
word32 idx = 0;
@@ -2239,8 +2238,7 @@ int wolfSSH_SFTP_RecvOpen(WOLFSSH* ssh, int reqId, byte* data, word32 maxSz)
22392238
return WS_BUFFER_E;
22402239
}
22412240

2242-
dirSz = sizeof(dir);
2243-
if (wolfSSH_GetPath(ssh->sftpDefaultPath, data + idx, sz, dir, &dirSz)
2241+
if (GetAndCleanPath(ssh->sftpDefaultPath, data + idx, sz, dir, sizeof(dir))
22442242
!= WS_SUCCESS) {
22452243
WLOG(WS_LOG_SFTP, "Creating path for file to open failed");
22462244
return WS_FATAL_ERROR;

0 commit comments

Comments
 (0)