aboutsummaryrefslogtreecommitdiffstats
path: root/pcap-util.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-11-09 08:16:25 +0000
committerGuy Harris <guy@alum.mit.edu>2001-11-09 08:16:25 +0000
commit45900852ffb2be6e0b454151c5d4be5dd99f4f62 (patch)
treeb84954a874ad8f5f26cf299e970f6a3cd08cf1f9 /pcap-util.c
parent4279815244cb4df2d63c6441d6c2073df04de62c (diff)
Fixes from Kazushi Sugyo:
1) print the payload length in AH headers correctly (the field's value is length of the payload, minus 2, divided by 2, so we have to add 2 before multiplying by 2); 2) correctly handle, in an SIOCGIFCONF list, entries whose address has an "sa_len" field less than the size of a "struct sockaddr" (the length of the address in an entry is the maximum of the real length and the size of a "struct sockaddr"). svn path=/trunk/; revision=4186
Diffstat (limited to 'pcap-util.c')
-rw-r--r--pcap-util.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/pcap-util.c b/pcap-util.c
index 80e60d54ea..044348137a 100644
--- a/pcap-util.c
+++ b/pcap-util.c
@@ -1,7 +1,7 @@
/* pcap-util.c
* Utility routines for packet capture
*
- * $Id: pcap-util.c,v 1.2 2001/11/09 07:51:01 guy Exp $
+ * $Id: pcap-util.c,v 1.3 2001/11/09 08:16:24 guy Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@ethereal.com>
@@ -325,7 +325,10 @@ get_interface_list(int *err, char *err_str)
next:
#ifdef HAVE_SA_LEN
- ifr = (struct ifreq *) ((char *) ifr + ifr->ifr_addr.sa_len + IFNAMSIZ);
+ ifr = (struct ifreq *) ((char *) ifr +
+ (ifr->ifr_addr.sa_len > sizeof(ifr->ifr_addr) ?
+ ifr->ifr_addr.sa_len : sizeof(ifr->ifr_addr)) +
+ IFNAMSIZ);
#else
ifr = (struct ifreq *) ((char *) ifr + sizeof(struct ifreq));
#endif