Skip to content

Commit

Permalink
virtio/fs/linux: Fix xattrs on symlinks (leak fix)
Browse files Browse the repository at this point in the history
Used the wrong function on CString...

Signed-off-by: Asahi Lina <[email protected]>
  • Loading branch information
asahilina authored and tylerfanelli committed Oct 16, 2024
1 parent 201124d commit bae75d6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/devices/src/virtio/fs/linux/passthrough.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1653,7 +1653,7 @@ impl FileSystem for PassthroughFs {
// Safe because this doesn't modify any memory and we check the return value.
unsafe {
libc::lsetxattr(
link.into_raw(),
link.as_ptr(),
name.as_ptr(),
value.as_ptr() as *const libc::c_void,
value.len(),
Expand Down Expand Up @@ -1706,7 +1706,7 @@ impl FileSystem for PassthroughFs {
// Safe because this will only modify the contents of `buf`.
unsafe {
libc::lgetxattr(
link.into_raw(),
link.as_ptr(),
name.as_ptr(),
buf.as_mut_ptr() as *mut libc::c_void,
size as libc::size_t,
Expand Down Expand Up @@ -1750,7 +1750,7 @@ impl FileSystem for PassthroughFs {
}
FileOrLink::Link(link) => unsafe {
libc::llistxattr(
link.into_raw(),
link.as_ptr(),
buf.as_mut_ptr() as *mut libc::c_char,
size as libc::size_t,
)
Expand Down Expand Up @@ -1783,7 +1783,7 @@ impl FileSystem for PassthroughFs {
}
FileOrLink::Link(link) => {
// Safe because this doesn't modify any memory and we check the return value.
unsafe { libc::lremovexattr(link.into_raw(), name.as_ptr()) }
unsafe { libc::lremovexattr(link.as_ptr(), name.as_ptr()) }
}
};

Expand Down

0 comments on commit bae75d6

Please sign in to comment.