Skip to content
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.

Commit

Permalink
check that relative path does not contain ..
Browse files Browse the repository at this point in the history
  • Loading branch information
petar committed Aug 5, 2021
1 parent 654d975 commit 1e861df
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions extractor.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ func (te *Extractor) Extract(reader io.Reader) error {
if err != nil || rel == "." {
return errInvalidRootMultipleRoots
}
for _, e := range strings.Split(rel, "/") {
if e == ".." {
return fmt.Errorf("relative path contains '..'")
}
}

switch header.Typeflag {
case tar.TypeDir:
Expand Down

0 comments on commit 1e861df

Please sign in to comment.