Skip to content
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

Xattr not passed correctly to OSX? #6

Open
sepiroth887 opened this issue Mar 29, 2012 · 1 comment
Open

Xattr not passed correctly to OSX? #6

sepiroth887 opened this issue Mar 29, 2012 · 1 comment

Comments

@sepiroth887
Copy link

Hi,

I am working on a Ramdisk implementation using fuse4j. So far almost everything works quite nicely.

listing xattributes in terminal via ls -l@ shows some weird behaviour. Find below a printout of the console part :

-rw-r--r--@ 1 tobiashaag staff 346 29 Mar 16:44 sdfgsdfg.rtf
com.apple.quarantine 23
-CDEF000000 -1

if i run ls -l@ again this is the result :

-rw-r--r--@ 1 tobiashaag staff 346 29 Mar 16:44 sdfgsdfg.rtf
com.apple.quarantine 23
-1
-1

seems some arbitrary memory locations are read, i.e the buffer for the attribute name in the listxattr() method seems to be the culprit.

Let me know if its just an implementation issue on my end or whether another fix is needed.

Thanks and great work !

Tobi

@sepiroth887
Copy link
Author

some further prodding revealed that the xattr name size as calculated by XAttrSizeSetter is not exactly the size of the name under some circumstances which means that the buffer is to big and random memory locations are read after the last nil terminator.

I have fixed this issue on my fork as well and could make another pull request if you like but it really is a one-line change:

Filesystem3ToFuseFSAdapter.java:470

replace: size+= (int) ((float)xattrName * enc......
with : size += xattrName.getBytes("UTF-8").length+1

.getBytes() can throw an exception so surround with try catch.

cheers,

Tobi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant