Skip to content

Commit

Permalink
Ensure binary is found within archive
Browse files Browse the repository at this point in the history
  • Loading branch information
myhro committed Sep 9, 2024
1 parent 65a97ba commit 3b7c1d4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tools/tools.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ func (t *Tool) Extract() error {

tr := tar.NewReader(compFile)

found := false

for {
hdr, err := tr.Next()
if errors.Is(err, io.EOF) {
Expand All @@ -105,10 +107,16 @@ func (t *Tool) Extract() error {
return fmt.Errorf("saveBinary: %w", err)
}

found = true

break
}
}

if !found {
return fmt.Errorf("binary not found in archive: %v", t.Asset.WithinArchive)
}

return nil
}

Expand Down

0 comments on commit 3b7c1d4

Please sign in to comment.