Skip to content

Commit 73efe14

Browse files
authored
Merge pull request #3676 from purplesyringa/cmsg-pointer-arithmetic
Fix out-of-bounds pointer arithmetic in CMSG_NXTHDR
2 parents 086bd0b + dc88f4c commit 73efe14

File tree

1 file changed

+1
-1
lines changed
  • src/unix/linux_like/linux

1 file changed

+1
-1
lines changed

src/unix/linux_like/linux/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4650,7 +4650,7 @@ f! {
46504650
as *mut cmsghdr;
46514651
let max = (*mhdr).msg_control as usize
46524652
+ (*mhdr).msg_controllen as usize;
4653-
if (next.offset(1)) as usize > max ||
4653+
if (next.wrapping_offset(1)) as usize > max ||
46544654
next as usize + super::CMSG_ALIGN((*next).cmsg_len as usize) > max
46554655
{
46564656
0 as *mut cmsghdr

0 commit comments

Comments
 (0)