]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-arcnet.c
Don't do IPv6 stuff if INET6 isn't defined.
[tcpdump] / print-arcnet.c
index cdd4a650513a3c3b237d8fc14e69658b25461f0b..0ffb9220709b6253b372d3ccb59b0284dbffa7f7 100644 (file)
@@ -181,7 +181,7 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch
        u_int seqid = 0;
        u_char arc_type;
 
-       if (caplen < ARC_HDRLEN) {
+       if (caplen < ARC_HDRLEN || length < ARC_HDRLEN) {
                ND_PRINT((ndo, "[|arcnet]"));
                return (caplen);
        }
@@ -202,14 +202,14 @@ arcnet_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, const u_ch
        }
 
        if (phds) {
-               if (caplen < ARC_HDRNEWLEN) {
+               if (caplen < ARC_HDRNEWLEN || length < ARC_HDRNEWLEN) {
                        arcnet_print(ndo, p, length, 0, 0, 0);
                        ND_PRINT((ndo, "[|phds]"));
                        return (caplen);
                }
 
                if (ap->arc_flag == 0xff) {
-                       if (caplen < ARC_HDRNEWLEN_EXC) {
+                       if (caplen < ARC_HDRNEWLEN_EXC || length < ARC_HDRNEWLEN_EXC) {
                                arcnet_print(ndo, p, length, 0, 0, 0);
                                ND_PRINT((ndo, "[|phds extended]"));
                                return (caplen);
@@ -268,7 +268,7 @@ arcnet_linux_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, cons
        int archdrlen = 0;
        u_char arc_type;
 
-       if (caplen < ARC_LINUX_HDRLEN) {
+       if (caplen < ARC_LINUX_HDRLEN || length < ARC_LINUX_HDRLEN) {
                ND_PRINT((ndo, "[|arcnet]"));
                return (caplen);
        }
@@ -279,7 +279,7 @@ arcnet_linux_if_print(netdissect_options *ndo, const struct pcap_pkthdr *h, cons
        switch (arc_type) {
        default:
                archdrlen = ARC_LINUX_HDRNEWLEN;
-               if (caplen < ARC_LINUX_HDRNEWLEN) {
+               if (caplen < ARC_LINUX_HDRNEWLEN || length < ARC_LINUX_HDRNEWLEN) {
                        ND_PRINT((ndo, "[|arcnet]"));
                        return (caplen);
                }
@@ -326,11 +326,9 @@ arcnet_encap_print(netdissect_options *ndo, u_char arctype, const u_char *p,
                ip_print(ndo, p, length);
                return (1);
 
-#ifdef INET6
        case ARCTYPE_INET6:
                ip6_print(ndo, p, length);
                return (1);
-#endif /*INET6*/
 
        case ARCTYPE_ARP_OLD:
        case ARCTYPE_ARP: