The handle_setxattr method tries to convert the extended attribute's value to an OsString, and this is what it passes to the file system's setxattr method. But that's wrong. It's perfectly valid for an extended attribute to have binary data with one, many, or no NUL characters. Also, this signature is asymmetric with getxattr, which returns an extended attribute's value as Bytes.
setxattr should be changed to pass the value as a &[u8], just as write does.
The
handle_setxattr
method tries to convert the extended attribute's value to anOsString
, and this is what it passes to the file system'ssetxattr
method. But that's wrong. It's perfectly valid for an extended attribute to have binary data with one, many, or no NUL characters. Also, this signature is asymmetric withgetxattr
, which returns an extended attribute's value asBytes
.setxattr
should be changed to pass the value as a&[u8]
, just aswrite
does.