Skip to content

Commit

Permalink
Fix bug in CMSG_NXTHDR for android. CMSG_NXTHDR should return NUL…
Browse files Browse the repository at this point in the history
…L if it is the last control message in the chain.
  • Loading branch information
LinkTed committed Nov 15, 2020
1 parent d588f99 commit 724d1a3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/unix/linux_like/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2289,6 +2289,9 @@ pub const PF_VSOCK: ::c_int = AF_VSOCK;
f! {
pub fn CMSG_NXTHDR(mhdr: *const msghdr,
cmsg: *const cmsghdr) -> *mut cmsghdr {
if ((*cmsg).cmsg_len as usize) < ::mem::size_of::<cmsghdr>() {
return 0 as *mut cmsghdr;
};
let next = (cmsg as usize
+ super::CMSG_ALIGN((*cmsg).cmsg_len as usize))
as *mut cmsghdr;
Expand Down

0 comments on commit 724d1a3

Please sign in to comment.