You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In this case, the solution is buf.as_mut_ptr() as *mut c_void. The documentation on slice.as_ptr():
The caller must also ensure that the memory the pointer (non-transitively) points to is never written to (except inside an UnsafeCell) using this pointer or any pointer derived from it. If you need to mutate the contents of the slice, use as_mut_ptr.
I haven't checked any other code, so there may be more.
The text was updated successfully, but these errors were encountered:
For the
std::io::Write
implementation onTTYPort
, a*const
ptr is cast to*mut
:serial-rs/serial-unix/src/tty.rs
Line 149 in cb28b14
This is unnecessary, as
libc::write
takesbuf: *const c_void
, sobuf.as_ptr() as *const c_void
would work fine.For the
std::io::Read
implementation onTTYPort
, similar but worse, as the pointer is mutated:serial-rs/serial-unix/src/tty.rs
Line 132 in cb28b14
In this case, the solution is
buf.as_mut_ptr() as *mut c_void
. The documentation on slice.as_ptr():I haven't checked any other code, so there may be more.
The text was updated successfully, but these errors were encountered: