Skip to content

Commit

Permalink
models/scanner: fix nullptr deref (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
rupansh authored Sep 19, 2023
1 parent f7a6366 commit 412fcdf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/models/scanner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
#include <arpa/inet.h>

bool NetworkScanner::is_network(const struct ifaddrs *ifaddr) const {
if (ifaddr->ifa_addr == NULL) {
return false;
}

sa_family_t family = ifaddr->ifa_addr->sa_family;
unsigned int flags = ifaddr->ifa_flags;
bool is_up = (flags & IFF_UP) != 0;
Expand Down Expand Up @@ -124,4 +128,4 @@ Interface NetworkScanner::get_interface_by_ip(const std::string &ip) const {
}
}
return Interface();
}
}

0 comments on commit 412fcdf

Please sign in to comment.