Skip to content

Commit

Permalink
Fix out-of-bounds pointer arithmetic in CMSG_NXTHDR
Browse files Browse the repository at this point in the history
(apply <#3676> to `main`)
(cherry picked from commit dc88f4c)
  • Loading branch information
purplesyringa authored and tgross35 committed Aug 28, 2024
1 parent 6a5464a commit a6caa32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5138,7 +5138,7 @@ f! {
as *mut cmsghdr;
let max = (*mhdr).msg_control as usize
+ (*mhdr).msg_controllen as usize;
if (next.offset(1)) as usize > max ||
if (next.wrapping_offset(1)) as usize > max ||
next as usize + super::CMSG_ALIGN((*next).cmsg_len as usize) > max
{
0 as *mut cmsghdr
Expand Down

0 comments on commit a6caa32

Please sign in to comment.