Skip to content

Commit a2e65a9

Browse files
authored
Merge pull request #521 from oasisprotocol/ptrus/fix/artifacts-cleanup-linkpath
rofl/build: Sanitize symlink target path
2 parents 4bee075 + f0b9c53 commit a2e65a9

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

cmd/rofl/build/artifacts.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,12 @@ FILES:
184184
}
185185
case tar.TypeSymlink:
186186
// Symbolic link.
187-
if err = os.Symlink(header.Linkname, path); err != nil {
187+
var linkPath string
188+
linkPath, err = cleanupPath(header.Linkname)
189+
if err != nil {
190+
return err
191+
}
192+
if err = os.Symlink(linkPath, path); err != nil {
188193
return fmt.Errorf("failed to create soft link: %w", err)
189194
}
190195
case tar.TypeChar, tar.TypeBlock, tar.TypeFifo:

0 commit comments

Comments
 (0)