Skip to content

Commit a6caa32

Browse files
purplesyringatgross35
authored andcommitted
Fix out-of-bounds pointer arithmetic in CMSG_NXTHDR
(apply <#3676> to `main`) (cherry picked from commit dc88f4c)
1 parent 6a5464a commit a6caa32

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5138,7 +5138,7 @@ f! {
51385138
as *mut cmsghdr;
51395139
let max = (*mhdr).msg_control as usize
51405140
+ (*mhdr).msg_controllen as usize;
5141-
if (next.offset(1)) as usize > max ||
5141+
if (next.wrapping_offset(1)) as usize > max ||
51425142
next as usize + super::CMSG_ALIGN((*next).cmsg_len as usize) > max
51435143
{
51445144
0 as *mut cmsghdr

0 commit comments

Comments
 (0)