[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
This commit is contained in:
William Wilgus 2024-04-07 14:13:21 -04:00
parent 4e1faa032f
commit d1f14c7b46

View file

@ -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;
}