We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0419762 commit 102a521Copy full SHA for 102a521
src/js.rs
@@ -33,6 +33,9 @@ pub(crate) unsafe fn getrandom_inner(mut dst: *mut u8, mut len: usize) -> Result
33
34
match source {
35
RngSource::Node(n) => {
36
+ // We have to create a slice to pass it to the Node function.
37
+ // Since `dst` may be uninitialized, we have to initialize it first.
38
+ core::ptr::write_bytes(dst, 0, len);
39
let dst = core::slice::from_raw_parts_mut(dst, len);
40
if n.random_fill_sync(dst).is_err() {
41
return Err(Error::NODE_RANDOM_FILL_SYNC);
0 commit comments