ash/ash-rewrite
Marijn Suijten befb8cdd36
Switch to safe CStr::from_bytes_until_nul on sized c_char array wrapper (#746)
Certain structs contain sized character arrays that are converted to
`CStr` for convenient accss to the user and our `Debug` implementation
using unsafe `CStr::from_ptr(...as_ptr())`.  There is no need to
round-trip to a pointer and possibly read out of bounds if the
NUL-terminator index (string length) is instead searched for by the
newly stabilized `CStr::from_bytes_until_nul()` fn since Rust 1.69
(which panics if no NUL-terminator is found before the end of the
slice).

Unfortunately `unsafe` is still needed to cast the array from a `c_char`
(`i8` on most platforms) to `u8`, which is what `from_bytes_until_nul()`
accepts.
2023-12-02 20:04:57 +01:00
..
src rewrite: Absolute basics (#713) 2023-03-13 22:06:38 +01:00
build.rs rewrite: Absolute basics (#713) 2023-03-13 22:06:38 +01:00
Cargo.toml Switch to safe CStr::from_bytes_until_nul on sized c_char array wrapper (#746) 2023-12-02 20:04:57 +01:00
LICENSE-APACHE rewrite: Absolute basics (#713) 2023-03-13 22:06:38 +01:00
LICENSE-MIT rewrite: Absolute basics (#713) 2023-03-13 22:06:38 +01:00