Browse Source

MacOS: Fixed a memory access bug when handling MAC addresses

tags/2021-05-28
Tom Poole 6 years ago
parent
commit
8deef0b4bc
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      modules/juce_core/native/juce_mac_Network.mm

+ 3
- 3
modules/juce_core/native/juce_mac_Network.mm View File

@@ -32,10 +32,10 @@ void MACAddress::findAllAddresses (Array<MACAddress>& result)
for (const ifaddrs* cursor = addrs; cursor != nullptr; cursor = cursor->ifa_next) for (const ifaddrs* cursor = addrs; cursor != nullptr; cursor = cursor->ifa_next)
{ {
// Required to avoid misaligned pointer access // Required to avoid misaligned pointer access
sockaddr_storage sto;
std::memcpy (&sto, cursor->ifa_addr, sizeof (sockaddr_storage));
sockaddr sto;
std::memcpy (&sto, cursor->ifa_addr, sizeof (sockaddr));
if (sto.ss_family == AF_LINK)
if (sto.sa_family == AF_LINK)
{ {
auto sadd = (const sockaddr_dl*) cursor->ifa_addr; auto sadd = (const sockaddr_dl*) cursor->ifa_addr;


Loading…
Cancel
Save