-
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
Conversation
// 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]) |
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)
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 comment
The 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
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
When i was tracing down the bug i noticed all xattrIndex
already do this check or return false so i removed it
Quite the catch. Thank you for tracking it down. |
Got an error when trying to read another squashfs file from ubuntu. Not sure if I should have created an issue first. It was raising this error. Traced it down to a symlink reading the wrong part for the xattr.