Skip to content

Commit 9b6e9af

Browse files
committed
Auto merge of #1976 - LinkTed:master, r=JohnTitor
Fix bug in `CMSG_NXTHDR` for android. `CMSG_NXTHDR` should return NULL if it is the last control message in the chain.
2 parents c9fb51b + 724d1a3 commit 9b6e9af

File tree

1 file changed

+3
-0
lines changed
  • src/unix/linux_like/android

1 file changed

+3
-0
lines changed

src/unix/linux_like/android/mod.rs

+3
Original file line numberDiff line numberDiff line change
@@ -2289,6 +2289,9 @@ pub const PF_VSOCK: ::c_int = AF_VSOCK;
22892289
f! {
22902290
pub fn CMSG_NXTHDR(mhdr: *const msghdr,
22912291
cmsg: *const cmsghdr) -> *mut cmsghdr {
2292+
if ((*cmsg).cmsg_len as usize) < ::mem::size_of::<cmsghdr>() {
2293+
return 0 as *mut cmsghdr;
2294+
};
22922295
let next = (cmsg as usize
22932296
+ super::CMSG_ALIGN((*cmsg).cmsg_len as usize))
22942297
as *mut cmsghdr;

0 commit comments

Comments
 (0)