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:
lalyos 2014-04-25 05:54:20 +02:00
parent 02b08b3961
commit 0b1aab5435

View file

@ -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) {