Fix #1110: sanitize path from plugin

This commit is contained in:
Arun Prakash Jana 2021-07-19 03:51:32 +05:30
parent c470143113
commit 9972c4bdb0
No known key found for this signature in database
GPG Key ID: A75979F35C080412
1 changed files with 6 additions and 1 deletions

View File

@ -5084,7 +5084,12 @@ static void readpipe(int fd, char **path, char **lastname, char **lastdir)
return;
g_buf[len] = '\0'; /* Terminate the path read */
nextpath = g_buf;
if (g_buf[0] == '/') {
nextpath = g_buf;
len = xstrlen(g_buf);
while (--len && (g_buf[len] == '/')) /* Trim all trailing '/' */
g_buf[len] = '\0';
}
} else if (op == 'l') {
rmlistpath(); /* Remove last list mode path, if any */
nextpath = load_input(fd, *path);