]> The Tcpdump Group git mirrors - tcpdump/commitdiff
BGP: Fix the uses of the pointer to the end of current packet
authorFrancois-Xavier Le Bail <[email protected]>
Thu, 1 Mar 2018 16:07:00 +0000 (17:07 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Thu, 1 Mar 2018 16:07:39 +0000 (17:07 +0100)
Must be based on packet header caplen.

print-bgp.c

index ffae36728356899fccb7bffeead2ba347f648332..ae23f42c0003d907f58edda8b23c8a49b4861307 100644 (file)
@@ -3053,10 +3053,10 @@ trunc:
 
 void
 bgp_print(netdissect_options *ndo,
-          const u_char *dat, u_int length)
+          const u_char *dat, u_int length _U_)
 {
     const u_char *p;
-    const u_char *ep;
+    const u_char *ep = ndo->ndo_snapend;
     const u_char *start;
     const u_char marker[] = {
         0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
@@ -3065,10 +3065,6 @@ bgp_print(netdissect_options *ndo,
     const struct bgp *bgp_header;
     uint16_t hlen;
 
-    ep = dat + length;
-    if (ndo->ndo_snapend < dat + length)
-        ep = ndo->ndo_snapend;
-
     ND_PRINT(": BGP");
 
     if (ndo->ndo_vflag < 1) /* lets be less chatty */