Skip to content

Commit fe25569

Browse files
committed
manual_slice_size_calculation
1 parent bfbeb3e commit fe25569

File tree

1 file changed

+1
-1
lines changed
  • library/std/src/sys/windows

1 file changed

+1
-1
lines changed

library/std/src/sys/windows/c.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ pub fn nt_success(status: NTSTATUS) -> bool {
8282

8383
impl UNICODE_STRING {
8484
pub fn from_ref(slice: &[u16]) -> Self {
85-
let len = slice.len() * mem::size_of::<u16>();
85+
let len = mem::size_of_val(slice);
8686
Self { Length: len as _, MaximumLength: len as _, Buffer: slice.as_ptr() as _ }
8787
}
8888
}

0 commit comments

Comments
 (0)