Only allow absolute paths
This commit is contained in:
@ -38,6 +38,19 @@ void path_parse(const char *in, char *mp, char *path) {
|
||||
} else {
|
||||
path[j] = 0;
|
||||
}
|
||||
|
||||
if (path[0] != '/') {
|
||||
mp[0] = 0;
|
||||
path[0] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (string_strstr(path, "/../") || string_strstr(path, "/./")
|
||||
|| string_strcmp(path, "..") == 0 || string_strcmp(path, ".") == 0) {
|
||||
mp[0] = 0;
|
||||
path[0] = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const char *path_basename(const char *path) {
|
||||
|
||||
Reference in New Issue
Block a user