Skip to content

Commit 06fe99b

Browse files
committed
Clean SCP base path before filesystem access
Call wolfSSH_CleanPath on the client-supplied base path before ParseBasePathHelper so directory probing happens on canonicalised paths.
1 parent 42f48d3 commit 06fe99b

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/wolfscp.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1303,11 +1303,13 @@ int ParseScpCommand(WOLFSSH* ssh)
13031303
ssh->scpBasePath = ssh->scpBasePathDynamic;
13041304
WMEMCPY(ssh->scpBasePathDynamic, cmd + idx,
13051305
cmdSz - idx);
1306-
ret = ParseBasePathHelper(ssh, cmdSz);
1307-
if (ret == WS_SUCCESS &&
1308-
wolfSSH_CleanPath(ssh,
1309-
ssh->scpBasePathDynamic) < 0)
1306+
if (wolfSSH_CleanPath(ssh,
1307+
ssh->scpBasePathDynamic) < 0) {
13101308
ret = WS_FATAL_ERROR;
1309+
}
1310+
else {
1311+
ret = ParseBasePathHelper(ssh, cmdSz);
1312+
}
13111313
}
13121314
break;
13131315

0 commit comments

Comments
 (0)