]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-atalk.c
NTP: Run one test with -v and another without.
[tcpdump] / print-atalk.c
index a94c29ce25fd3f7f573ded68f2644e3dabe76476..08376b6296d242b7d74a78179814f60b7e462a0c 100644 (file)
@@ -79,7 +79,7 @@ ltalk_if_print(netdissect_options *ndo,
 {
        u_int hdrlen;
 
-       hdrlen = llap_print(ndo, p, h->caplen);
+       hdrlen = llap_print(ndo, p, h->len);
        if (hdrlen == 0) {
                /* Cut short by the snapshot length. */
                return (h->caplen);
@@ -216,6 +216,15 @@ aarp_print(netdissect_options *ndo,
 
        ND_PRINT((ndo, "aarp "));
        ap = (const struct aarp *)bp;
+       if (!ND_TTEST(*ap)) {
+               /* Just bail if we don't have the whole chunk. */
+               ND_PRINT((ndo, " [|aarp]"));
+               return;
+       }
+       if (length < sizeof(*ap)) {
+               ND_PRINT((ndo, " [|aarp %u]", length));
+               return;
+       }
        if (EXTRACT_16BITS(&ap->htype) == 1 &&
            EXTRACT_16BITS(&ap->ptype) == ETHERTYPE_ATALK &&
            ap->halen == 6 && ap->palen == 4 )
@@ -271,7 +280,6 @@ static void
 atp_print(netdissect_options *ndo,
           register const struct atATP *ap, u_int length)
 {
-       char c;
        uint32_t data;
 
        if ((const u_char *)(ap + 1) > ndo->ndo_snapend) {
@@ -337,7 +345,7 @@ atp_print(netdissect_options *ndo,
 
                /* there shouldn't be any control flags */
                if (ap->control & (atpXO|atpEOM|atpSTS)) {
-                       c = '[';
+                       char c = '[';
                        if (ap->control & atpXO) {
                                ND_PRINT((ndo, "%cXO", c));
                                c = ',';
@@ -348,7 +356,6 @@ atp_print(netdissect_options *ndo,
                        }
                        if (ap->control & atpSTS) {
                                ND_PRINT((ndo, "%cSTS", c));
-                               c = ',';
                        }
                        ND_PRINT((ndo, "]"));
                }
@@ -368,7 +375,6 @@ static void
 atp_bitmap_print(netdissect_options *ndo,
                  register u_char bm)
 {
-       register char c;
        register int i;
 
        /*
@@ -377,7 +383,7 @@ atp_bitmap_print(netdissect_options *ndo,
         * (gcc is smart enough to eliminate it, at least on the Sparc).
         */
        if ((bm + 1) & (bm & 0xff)) {
-               c = '<';
+               register char c = '<';
                for (i = 0; bm; ++i) {
                        if (bm & 1) {
                                ND_PRINT((ndo, "%c%d", c, i));