jarib/ffi-xattr — Issue #4: Corrupt attribute values
Author: nmeilick
Created: 2012-01-31 09:03:28+00:00
State: open

Hello Jari,

getxattr does not return a NULL terminated string, which sometimes leads to corrupted attribute values being returned by `str_ptr.read_string`. Changing the calls to the following should fix this and also avoid a potential race condition between getting the size and the value:
```
str_ptr = FFI::MemoryPointer.new(:char, size)
size = send(method, path, key, str_ptr, size)
str_ptr.read_string(size)
```