Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Socket::{send,recv}msg and MsgHdr(Mut) #447

Merged
merged 10 commits into from
Jun 8, 2023
Prev Previous commit
Next Next commit
Use proper truncation in set_msghdr_iov
  • Loading branch information
Thomasdezeeuw committed Jun 3, 2023
commit e7f6130716e41c86b4ea5c223200e071ab092f2d
2 changes: 1 addition & 1 deletion src/sys/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ pub(crate) fn set_msghdr_name(msg: &mut msghdr, name: &SockAddr) {
#[cfg(not(target_os = "redox"))]
pub(crate) fn set_msghdr_iov(msg: &mut msghdr, ptr: *mut libc::iovec, len: usize) {
msg.msg_iov = ptr;
msg.msg_iovlen = len as _;
msg.msg_iovlen = min(len, IovLen::MAX as usize) as IovLen;
}

#[cfg(not(target_os = "redox"))]
Expand Down
2 changes: 1 addition & 1 deletion src/sys/windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ pub(crate) fn set_msghdr_name(msg: &mut msghdr, name: &SockAddr) {

pub(crate) fn set_msghdr_iov(msg: &mut msghdr, ptr: *mut WSABUF, len: usize) {
msg.lpBuffers = ptr;
msg.dwBufferCount = len as _;
msg.dwBufferCount = min(len, u32::MAX as usize) as u32;
}

pub(crate) fn set_msghdr_control(msg: &mut msghdr, ptr: *mut u8, len: usize) {
Expand Down