From 0b1aab54355fb50522605e4d51018f905ddc6305 Mon Sep 17 00:00:00 2001 From: lalyos Date: Fri, 25 Apr 2014 05:54:20 +0200 Subject: [PATCH] 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 (github: lalyos) --- symlink/fs.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/symlink/fs.go b/symlink/fs.go index 4dcfdf3..257491f 100644 --- a/symlink/fs.go +++ b/symlink/fs.go @@ -63,10 +63,9 @@ func FollowSymlinkInScope(link, root string) (string, error) { return "", err } - switch dest[0] { - case '/': + if path.IsAbs(dest) { prev = filepath.Join(root, dest) - case '.': + } else { prev, _ = filepath.Abs(prev) if prev = filepath.Clean(filepath.Join(filepath.Dir(prev), dest)); len(prev) < len(root) {