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.
#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>
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);
trunc:
printf(" [|BGP]");
}
-
-
-
-
-
-
-
-
-
-
-