Skip to content

Commit

Permalink
call WintunReleaseReceivePacket (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
vnt-dev authored Dec 16, 2024
1 parent 9cdd4af commit dd56fac
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,12 @@ 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 dd56fac

Please sign in to comment.