mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
Remove unnecessary check
This commit is contained in:
@@ -103,10 +103,6 @@ func ExtractAllFromTar(tr *tar.Reader, dest_path string, optss ...TarExtractOpti
|
|||||||
if !filepath.IsAbs(link_target) {
|
if !filepath.IsAbs(link_target) {
|
||||||
link_target = filepath.Join(filepath.Dir(dest), link_target)
|
link_target = filepath.Join(filepath.Dir(dest), link_target)
|
||||||
}
|
}
|
||||||
// Ensure the symlink target is within the destination directory
|
|
||||||
if !strings.HasPrefix(filepath.Clean(link_target), filepath.Clean(dest_path)+string(os.PathSeparator)) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if err = os.Link(link_target, dest); err != nil {
|
if err = os.Link(link_target, dest); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -121,10 +117,9 @@ func ExtractAllFromTar(tr *tar.Reader, dest_path string, optss ...TarExtractOpti
|
|||||||
if !filepath.IsAbs(link_target) {
|
if !filepath.IsAbs(link_target) {
|
||||||
link_target = filepath.Join(filepath.Dir(dest), link_target)
|
link_target = filepath.Join(filepath.Dir(dest), link_target)
|
||||||
}
|
}
|
||||||
// Ensure the symlink target is within the destination directory
|
// We dont care about the link target being outside dest_path as
|
||||||
if !strings.HasPrefix(filepath.Clean(link_target), filepath.Clean(dest_path)+string(os.PathSeparator)) {
|
// we use EvalSymlinks on dest, so a symlink pointing outside
|
||||||
continue
|
// dest_path cannot cause writes outside dest_path.
|
||||||
}
|
|
||||||
if err = os.Symlink(link_target, dest); err != nil {
|
if err = os.Symlink(link_target, dest); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user