From d1f14c7b46ceb550c5cc6e60305ab2b8a50e95bd Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Sun, 7 Apr 2024 14:13:21 -0400 Subject: [BugFix] Hosted incoming directory component leading slashes leading slashes in directory components to path_append makes a path with a leading slash absolute and discards the basepath Change-Id: I65253080c0ca4278b559894104ab25ab199a3100 --- firmware/target/hosted/filesystem-app.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'firmware/target/hosted/filesystem-app.c') diff --git a/firmware/target/hosted/filesystem-app.c b/firmware/target/hosted/filesystem-app.c index b36f04a0fe..5b291154fa 100644 --- a/firmware/target/hosted/filesystem-app.c +++ b/firmware/target/hosted/filesystem-app.c @@ -210,7 +210,7 @@ const char * handle_special_dirs(const char *dir, unsigned flags, if (!strncmp(HOME_DIR, dir, HOME_DIR_LEN)) { const char *p = dir + HOME_DIR_LEN; - while (*p == '/') p++; + while (*p == PATH_SEPCH) p++; /* strip leading slashes */ path_append(buf, rbhome, p, bufsize); dir = buf; } @@ -232,6 +232,7 @@ const char * handle_special_dirs(const char *dir, unsigned flags, #endif ) { + while (*dir == PATH_SEPCH) dir++; /* strip leading slashes */ path_append(buf, PIVOT_ROOT, dir, bufsize); dir = buf; } -- cgit v1.2.3