package An official xmake package repository https://xrepo.xmake.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

23 lines
785 B

diff --git a/Pcap++/src/PcapLiveDevice.cpp b/Pcap++/src/PcapLiveDevice.cpp
index 7ac0f79e..5faa7c4d 100644
--- a/Pcap++/src/PcapLiveDevice.cpp
+++ b/Pcap++/src/PcapLiveDevice.cpp
@@ -1011,15 +1011,15 @@ namespace pcpp
return;
}
- uint8_t buf[len];
+ std::vector<uint8_t> buf(len);
- if (sysctl(mib, 6, buf, &len, nullptr, 0) < 0)
+ if (sysctl(mib, 6, buf.data(), &len, nullptr, 0) < 0)
{
PCPP_LOG_DEBUG("Error in retrieving MAC address: sysctl 2 error");
return;
}
- struct if_msghdr* ifm = (struct if_msghdr*)buf;
+ struct if_msghdr* ifm = (struct if_msghdr*)buf.data();
struct sockaddr_dl* sdl = (struct sockaddr_dl*)(ifm + 1);
uint8_t* ptr = (uint8_t*)LLADDR(sdl);
m_MacAddress = MacAddress(ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5]);