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) (tokio-rs#126)
  • Loading branch information
fasterthanlime authored and FrankReh committed Oct 7, 2022
1 parent e1d2ed9 commit 86d7767
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 @@ -5,7 +5,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 @@ -16,7 +18,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 86d7767

Please sign in to comment.