]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-wb.c
update change log: add support for LACP, MARKER as per 802.3ad
[tcpdump] / print-wb.c
index a1455b2220b0aa738bbcce8e8318dcafec9adaab..3ae604ffed0b791de6eaf59824fed3ab172a261d 100644 (file)
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
+#ifndef lint
+static const char rcsid[] _U_ =
+    "@(#) $Header: /tcpdump/master/tcpdump/print-wb.c,v 1.33 2004-03-24 04:06:28 guy Exp $ (LBL)";
+#endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #include "addrtoname.h"
 #include "extract.h"
 
 #include "addrtoname.h"
 #include "extract.h"
 
-#ifndef lint
-static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-wb.c,v 1.31 2003-11-15 00:39:44 guy Exp $ (LBL)";
-#endif
 /* XXX need to add byte-swapping macros! */
 /* XXX - you mean like the ones in "extract.h"? */
 
 /* XXX need to add byte-swapping macros! */
 /* XXX - you mean like the ones in "extract.h"? */
 
@@ -212,7 +212,7 @@ wb_id(const struct pkt_id *id, u_int len)
        }
 
        c = '<';
        }
 
        c = '<';
-       for (i = 0; i < nid && (u_char *)io < snapend; ++io, ++i) {
+       for (i = 0; i < nid && (u_char *)(io + 1) <= snapend; ++io, ++i) {
                printf("%c%s:%u",
                    c, ipaddr_string(&io->id), EXTRACT_32BITS(&io->off));
                c = ',';
                printf("%c%s:%u",
                    c, ipaddr_string(&io->id), EXTRACT_32BITS(&io->off));
                c = ',';
@@ -267,7 +267,7 @@ wb_prep(const struct pkt_prep *prep, u_int len)
        }
        n = EXTRACT_32BITS(&prep->pp_n);
        ps = (const struct pgstate *)(prep + 1);
        }
        n = EXTRACT_32BITS(&prep->pp_n);
        ps = (const struct pgstate *)(prep + 1);
-       while (--n >= 0 && (u_char *)ps < ep) {
+       while (--n >= 0 && (u_char *)(ps + 1) <= ep) {
                const struct id_off *io, *ie;
                char c = '<';
 
                const struct id_off *io, *ie;
                char c = '<';
 
@@ -276,7 +276,7 @@ wb_prep(const struct pkt_prep *prep, u_int len)
                    ipaddr_string(&ps->page.p_sid),
                    EXTRACT_32BITS(&ps->page.p_uid));
                io = (struct id_off *)(ps + 1);
                    ipaddr_string(&ps->page.p_sid),
                    EXTRACT_32BITS(&ps->page.p_uid));
                io = (struct id_off *)(ps + 1);
-               for (ie = io + ps->nid; io < ie && (u_char *)io < ep; ++io) {
+               for (ie = io + ps->nid; io < ie && (u_char *)(io + 1) <= ep; ++io) {
                        printf("%c%s:%u", c, ipaddr_string(&io->id),
                            EXTRACT_32BITS(&io->off));
                        c = ',';
                        printf("%c%s:%u", c, ipaddr_string(&io->id),
                            EXTRACT_32BITS(&io->off));
                        c = ',';