mirror of
https://github.com/clearlinux/rkt.git
synced 2026-09-06 22:01:54 +00:00
Fix creation of HardLinks. The LinkName of an hardlink is relative to the tar's root.
This commit is contained in:
+2
-2
@@ -43,11 +43,11 @@ func ExtractTar(tr *tar.Reader, dir string) error {
|
||||
return err
|
||||
}
|
||||
case typ == tar.TypeLink:
|
||||
dest := filepath.Join(filepath.Dir(p), hdr.Linkname)
|
||||
dest := filepath.Join(dir, hdr.Linkname)
|
||||
if !strings.HasPrefix(dest, dir) {
|
||||
return insecureLinkError(fmt.Errorf("insecure link %q -> %q", p, hdr.Linkname))
|
||||
}
|
||||
if err := os.Link(hdr.Linkname, p); err != nil {
|
||||
if err := os.Link(dest, p); err != nil {
|
||||
return err
|
||||
}
|
||||
case typ == tar.TypeSymlink:
|
||||
|
||||
Reference in New Issue
Block a user