F-5852 - Only treat /.. as parent traversal in CleanPath

pull/1073/head
aidan garske 2026-07-10 12:05:39 -07:00 committed by John Safranek
parent 091310a1eb
commit ea22e2962a
1 changed files with 3 additions and 2 deletions

View File

@ -19885,8 +19885,9 @@ int wolfSSH_CleanPath(WOLFSSH* ssh, char* in, int inSz)
if (path[i] == WS_DELIM) {
int z;
/* if next two chars are .. then delete */
if (path[i+1] == '.' && path[i+2] == '.') {
/* delete only a real ".." segment, not "..name" */
if (path[i+1] == '.' && path[i+2] == '.' &&
(path[i+3] == WS_DELIM || path[i+3] == '\0')) {
enIdx = i + 3;
/* start at one char before / and retrace path */