Skip to content

Commit

Permalink
Box the socket address to allow moving the future (which async functi…
Browse files Browse the repository at this point in the history
…ons routinely do) (#126)
  • Loading branch information
fasterthanlime authored Oct 6, 2022
1 parent 1c0a2bf commit a42af77
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/driver/connect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ use std::io;
/// Open a file
pub(crate) struct Connect {
fd: SharedFd,
socket_addr: SockAddr,
// this avoids a UAF (UAM?) if the future is moved, but not if the future is
// dropped. no Op can be dropped before completion in tokio-uring land right now.
socket_addr: Box<SockAddr>,
}

impl Op<Connect> {
Expand All @@ -17,7 +19,7 @@ impl Op<Connect> {
Op::submit_with(
Connect {
fd: fd.clone(),
socket_addr,
socket_addr: Box::new(socket_addr),
},
|connect| {
opcode::Connect::new(
Expand Down

0 comments on commit a42af77

Please sign in to comment.