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 b4378bb commit 99721c7Copy full SHA for 99721c7
quinn-udp/src/cmsg/unix.rs
@@ -43,7 +43,15 @@ impl MsgHdr for crate::imp::msghdr_x {
43
44
fn cmsg_nxt_hdr(&self, cmsg: &Self::ControlMessage) -> *mut Self::ControlMessage {
45
let selfp = self as *const _ as *mut libc::msghdr;
46
- unsafe { libc::CMSG_NXTHDR(selfp, cmsg) }
+ let next = unsafe { libc::CMSG_NXTHDR(selfp, cmsg) };
47
+
48
+ if next.is_null()
49
+ || unsafe { (*next).cmsg_len as usize } < std::mem::size_of::<libc::cmsghdr>()
50
+ {
51
+ return std::ptr::null_mut();
52
+ }
53
54
+ next
55
}
56
57
fn set_control_len(&mut self, len: usize) {
0 commit comments