1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Fix WinPcap crash on pcap_findalldevs error

See http://seclists.org/nmap-dev/2015/q1/176

Fixes #15
This commit is contained in:
dmiller
2015-02-12 16:52:02 +00:00
parent 54c737a377
commit a86b679404
4 changed files with 33 additions and 3 deletions

View File

@@ -1,5 +1,8 @@
# Nmap Changelog ($Id$); -*-text-*-
o Solve a crash on Windows 8.1 on Surface Pro 3 caused by WinPcap trying to
write an error message to a NULL pointer. [Peter Malecka]
o Change the URI for the fingerprint submitter to its new location at
https://nmap.org/cgi-bin/submit.cgi

View File

@@ -2007,3 +2007,28 @@ index 8953b5b..05a0692 100644
case ARP_HRD_IEEE80211_RADIOTAP: /* IEEE 802.11 + radiotap header */
a->addr_type = ADDR_TYPE_ETH;
a->addr_bits = ETH_ADDR_BITS;
o Fix a crash when pcap_findalldevs encounters errors and tries to write to
errbuf. As demonstrated by WinPcap crashing on Surface Pro 3
diff --git a/libdnet-stripped/src/intf-win32.c b/libdnet-stripped/src/intf-win32.c
index 22c2d59..22c1e6a 100644
--- a/libdnet-stripped/src/intf-win32.c
+++ b/libdnet-stripped/src/intf-win32.c
@@ -425,6 +425,7 @@ intf_get_pcap_devname(const char *intf_name, char *pcapdev, int pcapdevlen)
pcap_if_t *pcapdevs;
pcap_if_t *pdev, *selected;
intf_t *intf;
+ char errbuf[PCAP_ERRBUF_SIZE];
if ((intf = intf_open()) == NULL)
return (-1);
@@ -439,7 +440,7 @@ intf_get_pcap_devname(const char *intf_name, char *pcapdev, int pcapdevlen)
return (-1);
}
- if (pcap_findalldevs(&pcapdevs, NULL) == -1) {
+ if (pcap_findalldevs(&pcapdevs, errbuf) == -1) {
intf_close(intf);
return (-1);
}

View File

@@ -425,6 +425,7 @@ intf_get_pcap_devname(const char *intf_name, char *pcapdev, int pcapdevlen)
pcap_if_t *pcapdevs;
pcap_if_t *pdev, *selected;
intf_t *intf;
char errbuf[PCAP_ERRBUF_SIZE];
if ((intf = intf_open()) == NULL)
return (-1);
@@ -439,7 +440,7 @@ intf_get_pcap_devname(const char *intf_name, char *pcapdev, int pcapdevlen)
return (-1);
}
if (pcap_findalldevs(&pcapdevs, NULL) == -1) {
if (pcap_findalldevs(&pcapdevs, errbuf) == -1) {
intf_close(intf);
return (-1);
}

View File

@@ -2033,9 +2033,10 @@ pcap_if_t *getpcapinterfaces() {
return NULL;
#endif
pcap_if_t *p_ifaces;
char errbuf[PCAP_ERRBUF_SIZE];
if ((pcap_findalldevs(&p_ifaces, NULL)) == -1) {
fatal("pcap_findalldevs() : Cannot retrieve pcap interfaces");
if ((pcap_findalldevs(&p_ifaces, errbuf)) == -1) {
fatal("pcap_findalldevs(): Cannot retrieve pcap interfaces: %s", errbuf);
return NULL;
}
return p_ifaces;