POSIX: PCAP: Check header & data before using

pull/56/head
Kyle Schwarz 2022-12-19 03:03:12 -05:00
parent 78465e0f20
commit f4e4a103ad
1 changed files with 1 additions and 1 deletions

View File

@ -140,7 +140,7 @@ void PCAP::Find(std::vector<FoundDevice>& found) {
struct pcap_pkthdr* header;
const uint8_t* data;
auto res = pcap_next_ex(iface.fp, &header, &data);
if(res < 0) {
if(res < 0 || !header || !data) {
if (!warned) {
warned = true;
EventManager::GetInstance().add(APIEvent::Type::PCAPCouldNotFindDevices, APIEvent::Severity::EventWarning);