aboutsummaryrefslogtreecommitdiff
path: root/fad-gifc.c
diff options
context:
space:
mode:
authorguy <guy>2004-02-27 08:03:05 +0000
committerguy <guy>2004-02-27 08:03:05 +0000
commitf61f1bb9a69b752c2c22d24baaa5e49e20712571 (patch)
tree96ce1beb085ef6c57203e46f9d530d63894ac175 /fad-gifc.c
parent673ea44790cb2dd7904d6515c25181b1b32ad914 (diff)
From Shaun Clowes: work around brokenness in the 32-bit compatibility
layer for Linux on IA-64.
Diffstat (limited to 'fad-gifc.c')
-rw-r--r--fad-gifc.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/fad-gifc.c b/fad-gifc.c
index 1e5de31f..035085dd 100644
--- a/fad-gifc.c
+++ b/fad-gifc.c
@@ -34,7 +34,7 @@
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/libpcap/fad-gifc.c,v 1.5 2003-11-15 23:23:58 guy Exp $ (LBL)";
+ "@(#) $Header: /tcpdump/master/libpcap/fad-gifc.c,v 1.6 2004-02-27 08:03:05 guy Exp $ (LBL)";
#endif
#ifdef HAVE_CONFIG_H
@@ -324,6 +324,20 @@ pcap_findalldevs(pcap_if_t **alldevsp, char *errbuf)
ifnext = (struct ifreq *)((char *)ifrp + n);
/*
+ * XXX - The 32-bit compatibility layer for Linux on IA-64
+ * is slightly broken. It correctly converts the structures
+ * to and from kernel land from 64 bit to 32 bit but
+ * doesn't update ifc.ifc_len, leaving it larger than the
+ * amount really used. This means we read off the end
+ * of the buffer and encounter an interface with an
+ * "empty" name. Since this is highly unlikely to ever
+ * occur in a valid case we can just finish looking for
+ * interfaces if we see an empty name.
+ */
+ if (!(*ifrp->ifr_name))
+ break;
+
+ /*
* Get the flags for this interface, and skip it if it's
* not up.
*/