Fixes 5370 infinite/maxLoopCount loop for relative symlinks
use path.IsAbs() instead of checking if first char is '/' Docker-DCO-1.1-Signed-off-by: Lajos Papp <lajos.papp@sequenceiq.com> (github: lalyos)
This commit is contained in:
parent
02b08b3961
commit
0b1aab5435
1 changed files with 2 additions and 3 deletions
|
@ -63,10 +63,9 @@ func FollowSymlinkInScope(link, root string) (string, error) {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
switch dest[0] {
|
if path.IsAbs(dest) {
|
||||||
case '/':
|
|
||||||
prev = filepath.Join(root, dest)
|
prev = filepath.Join(root, dest)
|
||||||
case '.':
|
} else {
|
||||||
prev, _ = filepath.Abs(prev)
|
prev, _ = filepath.Abs(prev)
|
||||||
|
|
||||||
if prev = filepath.Clean(filepath.Join(filepath.Dir(prev), dest)); len(prev) < len(root) {
|
if prev = filepath.Clean(filepath.Join(filepath.Dir(prev), dest)); len(prev) < len(root) {
|
||||||
|
|
Loading…
Reference in a new issue