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 b51c366bfc
commit ad35d522db
2 changed files with 3 additions and 3 deletions

View file

@ -189,6 +189,7 @@ Kimbro Staken <kstaken@kstaken.com>
Kiran Gangadharan <kiran.daredevil@gmail.com>
Konstantin Pelykh <kpelykh@zettaset.com>
Kyle Conroy <kyle.j.conroy@gmail.com>
Lajos Papp <lajos.papp@sequenceiq.com>
Laurie Voss <github@seldo.com>
Liang-Chi Hsieh <viirya@gmail.com>
Lokesh Mandvekar <lsm5@redhat.com>

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