Don't make the last statement in a loop a break statement, as that means
the body of the loop will be executed at most once.
When looping over the data in a TCP segment containing BGP packets, loop
until we reach the first of the end of the captured data or the end of
the segment, not just the end of the captured data.
#ifndef lint
static const char rcsid[] _U_ =
- "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.91.2.2 2005-04-20 20:22:33 guy Exp $";
+ "@(#) $Header: /tcpdump/master/tcpdump/print-bgp.c,v 1.91.2.3 2005-04-20 20:46:05 guy Exp $";
#endif
#include <tcpdump-stdinc.h>
tptr = pptr + len;
break;
}
+ if (advance < 0)
+ break;
tptr += advance;
- break;
}
done:
break;
tptr = pptr + len;
break;
}
+ if (advance < 0)
+ break;
tptr += advance;
- break;
}
break;
case BGPTYPE_EXTD_COMMUNITIES:
p = dat;
start = p;
- while (p < snapend) {
+ while (p < ep) {
if (!TTEST2(p[0], 1))
break;
if (p[0] != 0xff) {