We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bad2d36 commit 9e79890Copy full SHA for 9e79890
src/windows7.rs
@@ -25,8 +25,14 @@ const TRUE: BOOLEAN = 1u8;
25
26
pub fn getrandom_inner(dest: &mut [MaybeUninit<u8>]) -> Result<(), Error> {
27
// Prevent overflow of u32
28
- for chunk in dest.chunks_mut(u32::max_value() as usize) {
29
- let ret = unsafe { RtlGenRandom(chunk.as_mut_ptr().cast::<c_void>(), chunk.len() as u32) };
+ for chunk in dest.chunks_mut(u32::MAX as usize) {
+ let ret = unsafe {
30
+ RtlGenRandom(
31
+ chunk.as_mut_ptr().cast::<c_void>(),
32
+ #[allow(clippy::cast_possible_truncation)]
33
+ chunk.len() as u32,
34
+ )
35
+ };
36
if ret != TRUE {
37
return Err(Error::WINDOWS_RTL_GEN_RANDOM);
38
}
0 commit comments