]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-zep.c
DNS: Sync types with IANA
[tcpdump] / print-zep.c
index e10ecb35771ac849f12674f9053f608f56270d2c..8119a19e9a7bba6a2774f689522e93b13091dd3d 100644 (file)
@@ -77,7 +77,6 @@ static void zep_print_ts(netdissect_options *ndo, const u_char *p)
                                                billion */
        ND_PRINT("%u.%09d", i, f);
 
-#ifdef HAVE_STRFTIME
        /*
         * print the time in human-readable format.
         */
@@ -90,7 +89,6 @@ static void zep_print_ts(netdissect_options *ndo, const u_char *p)
                strftime(time_buf, sizeof (time_buf), "%Y/%m/%d %H:%M:%S", tm);
                ND_PRINT(" (%s)", time_buf);
        }
-#endif
 }
 
 /*
@@ -123,6 +121,7 @@ zep_print(netdissect_options *ndo,
 
        if (version == 1) {
                /* ZEP v1 packet. */
+               ND_LCHECK_U(len, 16);
                ND_PRINT("Channel ID %u, Device ID 0x%04x, ",
                         GET_U_1(bp + 3), GET_BE_U_2(bp + 4));
                if (GET_U_1(bp + 6))
@@ -138,6 +137,7 @@ zep_print(netdissect_options *ndo,
                /* ZEP v2 packet. */
                if (GET_U_1(bp + 3) == 2) {
                        /* ZEP v2 ack. */
+                       ND_LCHECK_U(len, 8);
                        seq_no = GET_BE_U_4(bp + 4);
                        ND_PRINT("ACK, seq# = %u", seq_no);
                        inner_len = 0;
@@ -145,6 +145,7 @@ zep_print(netdissect_options *ndo,
                        len -= 8;
                } else {
                        /* ZEP v2 data, or some other. */
+                       ND_LCHECK_U(len, 32);
                        ND_PRINT("Type %u, Channel ID %u, Device ID 0x%04x, ",
                                 GET_U_1(bp + 3), GET_U_1(bp + 4),
                                 GET_BE_U_2(bp + 5));
@@ -175,4 +176,7 @@ zep_print(netdissect_options *ndo,
 
        if (!ndo->ndo_suppress_default_print)
                ND_DEFAULTPRINT(bp, len);
+       return;
+invalid:
+       nd_print_invalid(ndo);
 }