diff options
author | itojun <itojun> | 2000-08-29 16:04:55 +0000 |
---|---|---|
committer | itojun <itojun> | 2000-08-29 16:04:55 +0000 |
commit | 2ccbd10907da8191c7b54973b1aac45316fe1267 (patch) | |
tree | c7e8a5a372f484aa9aad246bde6ccf184c4c613f /print-icmp6.c | |
parent | a424d22953d127a519e45e3b2cd529cd1207ff2e (diff) | |
download | tcpdump-2ccbd10907da8191c7b54973b1aac45316fe1267.tar.gz |
icmp6 nodeinfo printing; "node addresses" have TTL field with addresses.
repair boundary check, avoid overrun.
Diffstat (limited to 'print-icmp6.c')
-rw-r--r-- | print-icmp6.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/print-icmp6.c b/print-icmp6.c index 0dbf37e0..384d2a86 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -21,7 +21,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.19 2000-08-03 14:25:57 itojun Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-icmp6.c,v 1.20 2000-08-29 16:04:55 itojun Exp $"; #endif #ifdef HAVE_CONFIG_H @@ -825,10 +825,14 @@ icmp6_nodeinfo_print(int icmp6len, const u_char *bp, const u_char *ep) if (needcomma) printf(", "); printf("node addresses"); - for (i = sizeof(*ni6); - i < siz; - i += sizeof(struct in6_addr)) { + i = sizeof(*ni6); + while (i < siz) { + if (i + sizeof(struct in6_addr) + sizeof(int32_t) > siz) + break; printf(" %s", getname6(bp + i)); + i += sizeof(struct in6_addr); + printf("(%d)", ntohl(*(int32_t *)(bp + i))); + i += sizeof(int32_t); } i = ni6->ni_flags; if (!i) |