diff options
| author | David Lönnhager <david.l@mullvad.net> | 2024-05-02 18:03:03 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2024-05-03 08:18:46 +0200 |
| commit | 59095512896a596815cb4194401f458ee90c358a (patch) | |
| tree | d233ce71af540ccf4c3f75aba20a0ddc9da71596 | |
| parent | 02181e048b96d36dd577889266ea01574c768574 (diff) | |
| download | mullvadvpn-59095512896a596815cb4194401f458ee90c358a.tar.xz mullvadvpn-59095512896a596815cb4194401f458ee90c358a.zip | |
Fix clippy complaint about pointer cast
| -rw-r--r-- | talpid-core/src/split_tunnel/macos/bpf.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/talpid-core/src/split_tunnel/macos/bpf.rs b/talpid-core/src/split_tunnel/macos/bpf.rs index d2cd42bdcc..ec3f8fc62d 100644 --- a/talpid-core/src/split_tunnel/macos/bpf.rs +++ b/talpid-core/src/split_tunnel/macos/bpf.rs @@ -318,7 +318,9 @@ impl<'a> BpfIterMut<'a> { } // SAFETY: The buffer is large enough to contain a BPF header - let hdr = unsafe { &*(&self.data[offset] as *const u8 as *const bpf_hdr) }; + let hdr = unsafe { + &*(self.data[offset..offset + mem::size_of::<bpf_hdr>()].as_ptr() as *const bpf_hdr) + }; if offset + hdr.bh_hdrlen as usize + hdr.bh_caplen as usize > self.data.len() { return None; |
