Set base to root

This commit is contained in:
Davor Kapsa 2019-10-11 06:38:26 +02:00 committed by GitHub
parent 53960d48c7
commit fec0663bb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 0 deletions

View File

@ -423,6 +423,7 @@ func resolveSymlinksImpl(root, base, rel string, followCount uint) (string, erro
path := filepath.Join(base, name) path := filepath.Join(base, name)
if !strings.HasPrefix(path, root) { if !strings.HasPrefix(path, root) {
// One cannot '..' their way out of root. // One cannot '..' their way out of root.
base = root
continue continue
} }
fi, err := os.Lstat(path) fi, err := os.Lstat(path)