manual_slice_size_calculation

This commit is contained in:
Chris Denton 2023-11-21 23:17:29 +00:00
parent bfbeb3ebd9
commit fe255695f9
No known key found for this signature in database
GPG Key ID: 713472F2F45627DE

View File

@ -82,7 +82,7 @@ pub fn nt_success(status: NTSTATUS) -> bool {
impl UNICODE_STRING {
pub fn from_ref(slice: &[u16]) -> Self {
let len = slice.len() * mem::size_of::<u16>();
let len = mem::size_of_val(slice);
Self { Length: len as _, MaximumLength: len as _, Buffer: slice.as_ptr() as _ }
}
}