aboutsummaryrefslogtreecommitdiffstats
path: root/caputils
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2014-08-27 13:55:12 -0700
committerGerald Combs <gerald@wireshark.org>2014-08-27 22:11:58 +0000
commit5ee328e90b26f82fbd00316110c5edd9a5c852e6 (patch)
tree99a2e091379e92748c1b36885118589804902b29 /caputils
parenta8523d7df4f5d05932471526666e4711f13a7ca7 (diff)
Increase the error buffer size for rpcap.
If the rpcap port is unreachable pcap_findalldevs_ex can write more than PCAP_ERRBUF_SIZE bytes to errbuf. E.g. if we try to capture from Google's all-eights public DNS server we get: ---- Can't get list of interfaces: Is the server properly installed on 8.8.8.8? connect() failed: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. (code 1 ---- Set the buffer to PCAP_ERRBUF_SIZE*4 bytes. Hopefully that's large enough. Change-Id: I19f34cda16050c1ba8b9d7d6ed2d8e77b945a2af Ping-Bug: 3554 Ping-Bug: 6922 Ping-Bug: 7021 Reviewed-on: https://code.wireshark.org/review/3880 Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Evan Huus <eapache@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'caputils')
-rw-r--r--caputils/capture-pcap-util.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/caputils/capture-pcap-util.c b/caputils/capture-pcap-util.c
index 8755fcefaf..1c2cd2c36e 100644
--- a/caputils/capture-pcap-util.c
+++ b/caputils/capture-pcap-util.c
@@ -427,9 +427,13 @@ get_interface_list_findalldevs_ex(const char *source,
GList *il = NULL;
pcap_if_t *alldevs, *dev;
if_info_t *if_info;
- char errbuf[PCAP_ERRBUF_SIZE];
+ /*
+ * WinPcap can overflow PCAP_ERRBUF_SIZE if the host is unreachable.
+ * Fudge a larger size.
+ */
+ char errbuf[PCAP_ERRBUF_SIZE*4];
- if (pcap_findalldevs_ex((char *)source, auth, &alldevs, errbuf) == -1) {
+ if (pcap_findalldevs_ex((char *)source, auth, &alldevs, errbuf) == -1) {
*err = CANT_GET_INTERFACE_LIST;
if (err_str != NULL)
*err_str = cant_get_if_list_error_message(errbuf);