-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: dont include xattr in extended link reading #278
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -639,11 +639,12 @@ func parseExtendedSymlink(b []byte) (*extendedSymlink, int, error) { | |
s := &extendedSymlink{ | ||
links: binary.LittleEndian.Uint32(b[0:4]), | ||
} | ||
targetSize := int(binary.LittleEndian.Uint32(b[4:8])) | ||
// account for the synlink target, plus 4 bytes for the xattr index after it | ||
extra = int(binary.LittleEndian.Uint32(b[4:8])) + 4 | ||
if len(b[target:]) > extra { | ||
s.target = string(b[8 : 8+extra]) | ||
s.xAttrIndex = binary.LittleEndian.Uint32(b[8+extra : 8+extra+4]) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This was reading after the xattr data, so 4 bytes into the next section so it was just a random int |
||
extra = targetSize + 4 | ||
if len(b) >= extra+target { | ||
s.target = string(b[target : target+targetSize]) | ||
s.xAttrIndex = binary.LittleEndian.Uint32(b[target+targetSize : target+targetSize+4]) | ||
extra = 0 | ||
} | ||
return s, extra, nil | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -532,7 +532,7 @@ func (fs *FileSystem) hydrateDirectoryEntries(entries []*directoryEntryRaw) ([]* | |
body, header := in.getBody(), in.getHeader() | ||
xattrIndex, has := body.xattrIndex() | ||
xattrs := map[string]string{} | ||
if has && xattrIndex != noXattrInodeFlag { | ||
if has { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When i was tracing down the bug i noticed all |
||
xattrs, err = fs.xattrs.find(int(xattrIndex)) | ||
if err != nil { | ||
return nil, fmt.Errorf("error reading xattrs for %s: %v", e.name, err) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was reading 4 bytes to much (i.e. it was reading the xattr data as part of the target)