Skip to content

Commit

Permalink
call WintunReleaseReceivePacket
Browse files Browse the repository at this point in the history
  • Loading branch information
vnt-dev committed Dec 16, 2024
1 parent 9cdd4af commit c0ebb02
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,16 @@ impl Session {
}
let size = size as usize;
if size > buf.len() {
unsafe {
wintun.WintunReleaseReceivePacket(self.inner.0, ptr);
}
use std::io::{Error, ErrorKind::InvalidInput};
return Err(Error::new(InvalidInput, "destination buffer too small"));
}
unsafe { ptr::copy_nonoverlapping(ptr, buf.as_mut_ptr(), size) };
unsafe {
wintun.WintunReleaseReceivePacket(self.inner.0, ptr);
}
Ok(size)
}

Expand Down

0 comments on commit c0ebb02

Please sign in to comment.