mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 09:28:40 +02:00
POSIX: PCAP: Check header & data before using
This commit is contained in:
@@ -140,7 +140,7 @@ void PCAP::Find(std::vector<FoundDevice>& found) {
|
|||||||
struct pcap_pkthdr* header;
|
struct pcap_pkthdr* header;
|
||||||
const uint8_t* data;
|
const uint8_t* data;
|
||||||
auto res = pcap_next_ex(iface.fp, &header, &data);
|
auto res = pcap_next_ex(iface.fp, &header, &data);
|
||||||
if(res < 0) {
|
if(res < 0 || !header || !data) {
|
||||||
if (!warned) {
|
if (!warned) {
|
||||||
warned = true;
|
warned = true;
|
||||||
EventManager::GetInstance().add(APIEvent::Type::PCAPCouldNotFindDevices, APIEvent::Severity::EventWarning);
|
EventManager::GetInstance().add(APIEvent::Type::PCAPCouldNotFindDevices, APIEvent::Severity::EventWarning);
|
||||||
|
|||||||
Reference in New Issue
Block a user