mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41: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:
@@ -1,5 +1,8 @@
|
|||||||
# Nmap Changelog ($Id$); -*-text-*-
|
# 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
|
o Change the URI for the fingerprint submitter to its new location at
|
||||||
https://nmap.org/cgi-bin/submit.cgi
|
https://nmap.org/cgi-bin/submit.cgi
|
||||||
|
|
||||||
|
|||||||
@@ -2007,3 +2007,28 @@ index 8953b5b..05a0692 100644
|
|||||||
case ARP_HRD_IEEE80211_RADIOTAP: /* IEEE 802.11 + radiotap header */
|
case ARP_HRD_IEEE80211_RADIOTAP: /* IEEE 802.11 + radiotap header */
|
||||||
a->addr_type = ADDR_TYPE_ETH;
|
a->addr_type = ADDR_TYPE_ETH;
|
||||||
a->addr_bits = ETH_ADDR_BITS;
|
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);
|
||||||
|
}
|
||||||
|
|||||||
@@ -425,6 +425,7 @@ intf_get_pcap_devname(const char *intf_name, char *pcapdev, int pcapdevlen)
|
|||||||
pcap_if_t *pcapdevs;
|
pcap_if_t *pcapdevs;
|
||||||
pcap_if_t *pdev, *selected;
|
pcap_if_t *pdev, *selected;
|
||||||
intf_t *intf;
|
intf_t *intf;
|
||||||
|
char errbuf[PCAP_ERRBUF_SIZE];
|
||||||
|
|
||||||
if ((intf = intf_open()) == NULL)
|
if ((intf = intf_open()) == NULL)
|
||||||
return (-1);
|
return (-1);
|
||||||
@@ -439,7 +440,7 @@ intf_get_pcap_devname(const char *intf_name, char *pcapdev, int pcapdevlen)
|
|||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pcap_findalldevs(&pcapdevs, NULL) == -1) {
|
if (pcap_findalldevs(&pcapdevs, errbuf) == -1) {
|
||||||
intf_close(intf);
|
intf_close(intf);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|||||||
5
tcpip.cc
5
tcpip.cc
@@ -2033,9 +2033,10 @@ pcap_if_t *getpcapinterfaces() {
|
|||||||
return NULL;
|
return NULL;
|
||||||
#endif
|
#endif
|
||||||
pcap_if_t *p_ifaces;
|
pcap_if_t *p_ifaces;
|
||||||
|
char errbuf[PCAP_ERRBUF_SIZE];
|
||||||
|
|
||||||
if ((pcap_findalldevs(&p_ifaces, NULL)) == -1) {
|
if ((pcap_findalldevs(&p_ifaces, errbuf)) == -1) {
|
||||||
fatal("pcap_findalldevs() : Cannot retrieve pcap interfaces");
|
fatal("pcap_findalldevs(): Cannot retrieve pcap interfaces: %s", errbuf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return p_ifaces;
|
return p_ifaces;
|
||||||
|
|||||||
Reference in New Issue
Block a user