mirror of https://github.com/bobwen-dev/hunter
Update files.rs
This commit is contained in:
parent
26ab54fe74
commit
f4df2b9db9
|
@ -499,7 +499,7 @@ pub fn from_getdents(fd: i32, path: &Path, nothidden: &AtomicUsize) -> Result<V
|
|||
|
||||
let name: &OsStr = {
|
||||
// Safe as long as d_name is NULL terminated
|
||||
let true_len = unsafe { libc::strlen(d.d_name.as_ptr() as *const i8) };
|
||||
let true_len = unsafe { libc::strlen(d.d_name.as_ptr() as *const u8) };
|
||||
// Safe if strlen returned without SEGFAULT on OOB (if d_name weren't NULL terminated)
|
||||
let bytes: &[u8] = unsafe { std::slice::from_raw_parts(d.d_name.as_ptr() as *const u8,
|
||||
true_len) };
|
||||
|
|
Loading…
Reference in New Issue