diff options
author | guy <guy> | 2003-06-03 23:23:50 +0000 |
---|---|---|
committer | guy <guy> | 2003-06-03 23:23:50 +0000 |
commit | 13137dd548460931ce3c0a67a99e6e00bdcc0f53 (patch) | |
tree | e23b241e227097c167480b3a716d4dcadc806e1b /print-bgp.c | |
parent | f4d9457518b8aab88e43e5e19e9603e24fb45b74 (diff) | |
download | tcpdump-13137dd548460931ce3c0a67a99e6e00bdcc0f53.tar.gz |
Based on a patch from Michele "mydecay" Marchetto <smarchetto1@tin.it>:
check the header length to make sure it's at least the minimum length,
so we don't, for example, go into an infinite loop if the header length
is 0.
Get rid of some blank lines at the end of the file.
Diffstat (limited to 'print-bgp.c')
-rw-r--r-- | print-bgp.c | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/print-bgp.c b/print-bgp.c index 6a9f0486..8545f7a4 100644 --- a/print-bgp.c +++ b/print-bgp.c @@ -36,7 +36,7 @@ #ifndef lint static const char rcsid[] = - "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.66 2003-06-03 22:15:58 guy Exp $"; + "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.67 2003-06-03 23:23:50 guy Exp $"; #endif #include <tcpdump-stdinc.h> @@ -1587,6 +1587,11 @@ bgp_print(const u_char *dat, int length) printf(" [|BGP]"); hlen = ntohs(bgp.bgp_len); + if (hlen < BGP_SIZE) { + printf("\n[|BGP Bogus header length %u < %u]", hlen, + BGP_SIZE); + break; + } if (TTEST2(p[0], hlen)) { bgp_header_print(p, hlen); @@ -1603,14 +1608,3 @@ bgp_print(const u_char *dat, int length) trunc: printf(" [|BGP]"); } - - - - - - - - - - - |