|
let mut name_info_bytes = vec![0u8; size + MAX_PATH * mem::size_of::<WCHAR>()]; |
|
let res = GetFileInformationByHandleEx( |
|
GetStdHandle(fd), |
|
FileNameInfo, |
|
&mut *name_info_bytes as *mut _ as *mut c_void, |
|
name_info_bytes.len() as u32, |
|
); |
|
if res == 0 { |
|
return false; |
|
} |
|
let name_info: &FILE_NAME_INFO = &*(name_info_bytes.as_ptr() as *const FILE_NAME_INFO); |
As far as I can tell, the pointer deference on line 141 in unsound, as there is no guarantee the vector will be properly aligned for FILE_NAME_INFO (which has an alignment of 4 due to FileNameLength being a u32)
atty/src/lib.rs
Lines 131 to 141 in 7b5df17
As far as I can tell, the pointer deference on line 141 in unsound, as there is no guarantee the vector will be properly aligned for
FILE_NAME_INFO(which has an alignment of 4 due toFileNameLengthbeing au32)