Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass pointers, not slices, to libc::ioctl (#2181)
Slices are not FFI-safe. &[u8] and &mut [u8] are *wide pointers*, which means that at the moment, we're getting lucky because they're passed via the "ScalarPair" ABI, and this means that passing a `&[u8]` results in passing two arguments, `*const u8` and `usize` for pointer and length. This passes an extra argument to ioctl, which happens to work because the extra vararg is skipped. We're getting lucky right now, and we should explicitly pass the pointer we meant to pass instead. This is normally checked on `extern "C"` functions, but `ioctl` in particular uses varargs which prevents the compiler check from reporting.
- Loading branch information