fix(storepkg): mask the tar mode to the permission bits before narrowing
The conversion is now exact rather than a truncation: the low nine bits are the permission bits whatever the tar header's width.
This commit is contained in:
1 parent
4481d557a3
commit
8ae3a445a7
1 file changed
+3
-1
@@ -174,7 +174,9 @@ func validateLayerEntry(header *tar.Header, declared map[string]uint32, found ma
|
||||
if !ok || found[header.Name] {
|
||||
return fmt.Errorf("package layer contains undeclared or duplicate file %q", header.Name)
|
||||
}
|
||||
if uint32(header.Mode)&0o777 != mode&0o777 {
|
||||
// The mask makes the conversion exact: the low nine bits are the
|
||||
// permission bits whatever the tar header's width.
|
||||
if uint32(header.Mode&0o777) != mode&0o777 {
|
||||
return fmt.Errorf("package file %q mode differs from descriptor", header.Name)
|
||||
}
|
||||
return nil
|
||||
|
||||
Reference in new issue
Block a user