Skip to content

Commit

Permalink
(win) Adjust allocated buffer size for Interface information to match…
Browse files Browse the repository at this point in the history
… the returned interface length
  • Loading branch information
bltavares committed Dec 17, 2023
1 parent b994c8e commit b289c8b
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/win.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ fn build_address_table(interfaces: HashSet<Ipv4Addr>) -> io::Result<HashMap<u32,
return Err(io::Error::last_os_error());
}

let mut buffer =
vec![0; mem::size_of::<iptypes::IP_ADAPTER_INFO>() * interfaces.len() * (size as usize)];
let mut buffer = vec![0; mem::size_of::<iptypes::IP_ADAPTER_INFO>() * (size as usize)];
let mut adapter_info = buffer.as_mut_ptr() as iptypes::PIP_ADAPTER_INFO;
let mut size = buffer.len() as u32;
let r = unsafe { winapi::um::iphlpapi::GetAdaptersInfo(adapter_info, &mut size) };
Expand Down

0 comments on commit b289c8b

Please sign in to comment.