Skip to content

Commit

Permalink
Fix getsockopt zeroing memory (#901)
Browse files Browse the repository at this point in the history
This commit fixes an accidental regression from #858 where a previous
call to `core::mem::zeroed` was replaced with `MaybeUninit::uninit`
instead of `MaybeUninit::zeroed`.
  • Loading branch information
alexcrichton committed Oct 26, 2023
1 parent 36e3999 commit b01b482
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/backend/libc/net/sockopt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ fn getsockopt<T: Copy>(fd: BorrowedFd<'_>, level: i32, optname: i32) -> io::Resu
"Socket APIs don't ever use `bool` directly"
);

let mut value = MaybeUninit::<T>::uninit();
let mut value = MaybeUninit::<T>::zeroed();
getsockopt_raw(fd, level, optname, &mut value, &mut optlen)?;

// On Windows at least, `getsockopt` has been observed writing 1
Expand Down

0 comments on commit b01b482

Please sign in to comment.