]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Use more the EXTRACT_8BITS() macro to fetch a one-byte value (18/n)
authorFrancois-Xavier Le Bail <[email protected]>
Tue, 21 Nov 2017 20:53:35 +0000 (21:53 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 21 Nov 2017 21:23:47 +0000 (22:23 +0100)
Assignment, *(p op e)

Partial list.

14 files changed:
print-802_11.c
print-cdp.c
print-dccp.c
print-eap.c
print-geneve.c
print-gre.c
print-ldp.c
print-llc.c
print-lldp.c
print-ppp.c
print-radius.c
print-rrcp.c
print-rsvp.c
print-vtp.c

index 1f6f74f232218521d51d80a0f9db175dd9f724e2..8918d3d7fc0e9c2d8aead95e95263f4c06132639 100644 (file)
@@ -1023,7 +1023,7 @@ parse_elements(netdissect_options *ndo,
                        return 0;
                if (length < 2)
                        return 0;
-               elementlen = *(p + offset + 1);
+               elementlen = EXTRACT_8BITS(p + offset + 1);
 
                /* Make sure we have the entire element. */
                if (!ND_TTEST2(*(p + offset + 2), elementlen))
@@ -1123,7 +1123,7 @@ parse_elements(netdissect_options *ndo,
                                length -= ds.length;
                                break;
                        }
-                       ds.channel = *(p + offset);
+                       ds.channel = EXTRACT_8BITS(p + offset);
                        offset += 1;
                        length -= 1;
                        /*
index 6913e3c2226280fa14a4492923d2fe616539aa4d..188a3321b7d2aab0d823a86d92ed2193eb1d37c0 100644 (file)
@@ -170,7 +170,7 @@ cdp_print(netdissect_options *ndo,
                    case 0x05: /* Version */
                        ND_PRINT((ndo, "\n\t  "));
                        for (i=0;i<len;i++) {
-                           j = *(tptr+i);
+                           j = EXTRACT_8BITS(tptr + i);
                            if (j == '\n') /* lets rework the version string to
                                              get a nice indentation */
                                ND_PRINT((ndo, "\n\t  "));
index 56ab27467ba729675320d78db121c253ae22b425..7f7f81276e37d6c40f7efddefc183003e60fc052 100644 (file)
@@ -539,7 +539,7 @@ static int dccp_print_option(netdissect_options *ndo, const u_char *option, u_in
 
        if (*option >= 32) {
                ND_TCHECK(*(option+1));
-               optlen = *(option +1);
+               optlen = EXTRACT_8BITS(option + 1);
                if (optlen < 2) {
                        if (*option >= 128)
                                ND_PRINT((ndo, "CCID option %u optlen too short", *option));
index 895dbfe127cfa1caa3df4b65140f6dc4cd789e12..56388da0084acef02d8bb861a765392d13e8a45e 100644 (file)
@@ -196,7 +196,7 @@ eap_print(netdissect_options *ndo,
 
         if (type <= 2) { /* For EAP_REQUEST and EAP_RESPONSE only */
             ND_TCHECK_8BITS(tptr+4);
-            subtype = *(tptr+4);
+            subtype = EXTRACT_8BITS(tptr + 4);
             ND_PRINT((ndo, "\n\t\t Type %s (%u)",
                    tok2str(eap_type_values, "unknown", subtype),
                    subtype));
index f7054fb54bf733fced240c033e9f8a3e13a02c83..9ca7bf2ed153d6d0bb17050957df0976e6840795 100644 (file)
@@ -113,7 +113,7 @@ geneve_opts_print(netdissect_options *ndo, const u_char *bp, u_int len)
         sep = ", ";
 
         opt_class = EXTRACT_BE_16BITS(bp);
-        opt_type = *(bp + 2);
+        opt_type = EXTRACT_8BITS(bp + 2);
         opt_len = 4 + ((*(bp + 3) & OPT_LEN_MASK) * 4);
 
         ND_PRINT((ndo, "class %s (0x%x) type 0x%x%s len %u",
index 0de72886c1f8f56f7d83ed508e13afe18ef58c8f..a11cb9b84d3d940653a723b5c916a13cc9ebc5fb 100644 (file)
@@ -180,8 +180,8 @@ gre_print_0(netdissect_options *ndo, const u_char *bp, u_int length)
                        if (len < 4)
                                goto trunc;
                        af = EXTRACT_BE_16BITS(bp);
-                       sreoff = *(bp + 2);
-                       srelen = *(bp + 3);
+                       sreoff = EXTRACT_8BITS(bp + 2);
+                       srelen = EXTRACT_8BITS(bp + 3);
                        bp += 4;
                        len -= 4;
 
index ed176b70bcbbd8385f5326edff189e2a0d5b75df..df43da781a56e3a0ca6b510f6c768e49b477fcf0 100644 (file)
@@ -384,7 +384,7 @@ ldp_tlv_print(netdissect_options *ndo,
              * Pseudowire Types.
              */
             TLV_TCHECK(7);
-            vc_info_len = *(tptr+2);
+            vc_info_len = EXTRACT_8BITS(tptr + 2);
 
             /*
             * According to RFC 4908, the VC info Length field can be zero,
@@ -422,7 +422,7 @@ ldp_tlv_print(netdissect_options *ndo,
 
             while (vc_info_len > 2) {
                 vc_info_tlv_type = *tptr;
-                vc_info_tlv_len = *(tptr+1);
+                vc_info_tlv_len = EXTRACT_8BITS(tptr + 1);
                 if (vc_info_tlv_len < 2)
                     break;
                 if (vc_info_len < vc_info_tlv_len)
index b3fbef0f709d690aaa1d66e4497257bc3b95adc7..699cc63c7fd595c513533db713126d811d98ce2e 100644 (file)
@@ -167,7 +167,7 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
        }
 
        dsap_field = *p;
-       ssap_field = *(p + 1);
+       ssap_field = EXTRACT_8BITS(p + 1);
 
        /*
         * OK, what type of LLC frame is this?  The length
@@ -175,7 +175,7 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen,
         * have a two-byte control field, and U frames have
         * a one-byte control field.
         */
-       control = *(p + 2);
+       control = EXTRACT_8BITS(p + 2);
        if ((control & LLC_U_FMT) == LLC_U_FMT) {
                /*
                 * U frame.
index b06dab6180e8405e687ee7d5021d26d71e1d4ca4..ed97f40aec14bba047accd856d033a7fa37fa5db 100644 (file)
@@ -656,7 +656,7 @@ lldp_private_8021_print(netdissect_options *ndo,
     if (tlv_len < 4) {
         return hexdump;
     }
-    subtype = *(tptr+3);
+    subtype = EXTRACT_8BITS(tptr + 3);
 
     ND_PRINT((ndo, "\n\t  %s Subtype (%u)",
            tok2str(lldp_8021_subtype_values, "unknown", subtype),
@@ -687,7 +687,7 @@ lldp_private_8021_print(netdissect_options *ndo,
         if (tlv_len < 7) {
             return hexdump;
         }
-        sublen = *(tptr+6);
+        sublen = EXTRACT_8BITS(tptr + 6);
         if (tlv_len < 7+sublen) {
             return hexdump;
         }
@@ -698,7 +698,7 @@ lldp_private_8021_print(netdissect_options *ndo,
         if (tlv_len < 5) {
             return hexdump;
         }
-        sublen = *(tptr+4);
+        sublen = EXTRACT_8BITS(tptr + 4);
         if (tlv_len < 5+sublen) {
             return hexdump;
         }
@@ -709,13 +709,13 @@ lldp_private_8021_print(netdissect_options *ndo,
         if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_CONGESTION_NOTIFICATION_LENGTH){
                return hexdump;
         }
-        tval=*(tptr+4);
+        tval=EXTRACT_8BITS(tptr + 4);
         ND_PRINT((ndo, "\n\t    Pre-Priority CNPV Indicator"));
         ND_PRINT((ndo, "\n\t     Priority : 0  1  2  3  4  5  6  7"));
         ND_PRINT((ndo, "\n\t     Value    : "));
         for(i=0;i<NO_OF_BITS;i++)
             ND_PRINT((ndo, "%-2d ", (tval >> i) & 0x01));
-        tval=*(tptr+5);
+        tval=EXTRACT_8BITS(tptr + 5);
         ND_PRINT((ndo, "\n\t    Pre-Priority Ready Indicator"));
         ND_PRINT((ndo, "\n\t     Priority : 0  1  2  3  4  5  6  7"));
         ND_PRINT((ndo, "\n\t     Value    : "));
@@ -727,7 +727,7 @@ lldp_private_8021_print(netdissect_options *ndo,
         if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_ETS_CONFIGURATION_LENGTH) {
             return hexdump;
         }
-        tval=*(tptr+4);
+        tval=EXTRACT_8BITS(tptr + 4);
         ND_PRINT((ndo, "\n\t    Willing:%d, CBS:%d, RES:%d, Max TCs:%d",
                tval >> 7, (tval >> 6) & 0x02, (tval >> 3) & 0x07, tval & 0x07));
 
@@ -759,11 +759,11 @@ lldp_private_8021_print(netdissect_options *ndo,
         if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_PFC_CONFIGURATION_LENGTH) {
             return hexdump;
         }
-        tval=*(tptr+4);
+        tval=EXTRACT_8BITS(tptr + 4);
         ND_PRINT((ndo, "\n\t    Willing: %d, MBC: %d, RES: %d, PFC cap:%d ",
                tval >> 7, (tval >> 6) & 0x01, (tval >> 4) & 0x03, (tval & 0x0f)));
         ND_PRINT((ndo, "\n\t    PFC Enable"));
-        tval=*(tptr+5);
+        tval=EXTRACT_8BITS(tptr + 5);
         ND_PRINT((ndo, "\n\t     Priority : 0  1  2  3  4  5  6  7"));
         ND_PRINT((ndo, "\n\t     Value    : "));
         for(i=0;i<NO_OF_BITS;i++)
@@ -786,7 +786,7 @@ lldp_private_8021_print(netdissect_options *ndo,
         i=0;
         ND_PRINT((ndo, "\n\t    Application Priority Table"));
         while(i<sublen) {
-               tval=*(tptr+i+5);
+               tval=EXTRACT_8BITS(tptr + i + 5);
                ND_PRINT((ndo, "\n\t      Priority: %u, RES: %u, Sel: %u, Protocol ID: %u",
                         tval >> 5, (tval >> 3) & 0x03, (tval & 0x07),
                         EXTRACT_BE_16BITS(tptr + i + 5)));
@@ -798,20 +798,20 @@ lldp_private_8021_print(netdissect_options *ndo,
                return hexdump;
         }
         ND_PRINT((ndo, "\n\t    EVB Bridge Status"));
-        tval=*(tptr+4);
+        tval=EXTRACT_8BITS(tptr + 4);
         ND_PRINT((ndo, "\n\t      RES: %d, BGID: %d, RRCAP: %d, RRCTR: %d",
                tval >> 3, (tval >> 2) & 0x01, (tval >> 1) & 0x01, tval & 0x01));
         ND_PRINT((ndo, "\n\t    EVB Station Status"));
-        tval=*(tptr+5);
+        tval=EXTRACT_8BITS(tptr + 5);
         ND_PRINT((ndo, "\n\t      RES: %d, SGID: %d, RRREQ: %d,RRSTAT: %d",
                tval >> 4, (tval >> 3) & 0x01, (tval >> 2) & 0x01, tval & 0x03));
-        tval=*(tptr+6);
+        tval=EXTRACT_8BITS(tptr + 6);
         ND_PRINT((ndo, "\n\t    R: %d, RTE: %d, ",tval >> 5, tval & 0x1f));
-        tval=*(tptr+7);
+        tval=EXTRACT_8BITS(tptr + 7);
         ND_PRINT((ndo, "EVB Mode: %s [%d]",
                tok2str(lldp_evb_mode_values, "unknown", tval >> 6), tval >> 6));
         ND_PRINT((ndo, "\n\t    ROL: %d, RWD: %d, ", (tval >> 5) & 0x01, tval & 0x1f));
-        tval=*(tptr+8);
+        tval=EXTRACT_8BITS(tptr + 8);
         ND_PRINT((ndo, "RES: %d, ROL: %d, RKA: %d", tval >> 6, (tval >> 5) & 0x01, tval & 0x1f));
         break;
 
@@ -819,7 +819,7 @@ lldp_private_8021_print(netdissect_options *ndo,
         if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_CDCP_MIN_LENGTH){
                return hexdump;
         }
-        tval=*(tptr+4);
+        tval=EXTRACT_8BITS(tptr + 4);
         ND_PRINT((ndo, "\n\t    Role: %d, RES: %d, Scomp: %d ",
                tval >> 7, (tval >> 4) & 0x07, (tval >> 3) & 0x01));
         ND_PRINT((ndo, "ChnCap: %d", EXTRACT_BE_16BITS(tptr + 6) & 0x0fff));
@@ -856,7 +856,7 @@ lldp_private_8023_print(netdissect_options *ndo,
     if (tlv_len < 4) {
         return hexdump;
     }
-    subtype = *(tptr+3);
+    subtype = EXTRACT_8BITS(tptr + 3);
 
     ND_PRINT((ndo, "\n\t  %s Subtype (%u)",
            tok2str(lldp_8023_subtype_values, "unknown", subtype),
@@ -940,7 +940,7 @@ lldp_private_iana_print(netdissect_options *ndo,
     if (tlv_len < 8) {
         return hexdump;
     }
-    subtype = *(tptr+3);
+    subtype = EXTRACT_8BITS(tptr + 3);
 
     ND_PRINT((ndo, "\n\t  %s Subtype (%u)",
            tok2str(lldp_iana_subtype_values, "unknown", subtype),
@@ -976,7 +976,7 @@ lldp_private_tia_print(netdissect_options *ndo,
     if (tlv_len < 4) {
         return hexdump;
     }
-    subtype = *(tptr+3);
+    subtype = EXTRACT_8BITS(tptr + 3);
 
     ND_PRINT((ndo, "\n\t  %s Subtype (%u)",
            tok2str(lldp_tia_subtype_values, "unknown", subtype),
@@ -1016,7 +1016,7 @@ lldp_private_tia_print(netdissect_options *ndo,
         if (tlv_len < 5) {
             return hexdump;
         }
-        location_format = *(tptr+4);
+        location_format = EXTRACT_8BITS(tptr + 4);
         ND_PRINT((ndo, "\n\t    Location data format %s (0x%02x)",
                tok2str(lldp_tia_location_data_format_values, "unknown", location_format),
                location_format));
@@ -1045,7 +1045,7 @@ lldp_private_tia_print(netdissect_options *ndo,
             if (tlv_len < 6) {
                 return hexdump;
             }
-            lci_len = *(tptr+5);
+            lci_len = EXTRACT_8BITS(tptr + 5);
             if (lci_len < 3) {
                 return hexdump;
             }
@@ -1069,7 +1069,7 @@ lldp_private_tia_print(netdissect_options *ndo,
                     return hexdump;
                 }
                ca_type = *(tptr);
-                ca_len = *(tptr+1);
+                ca_len = EXTRACT_8BITS(tptr + 1);
 
                tptr += 2;
                 lci_len -= 2;
@@ -1159,7 +1159,7 @@ lldp_private_dcbx_print(netdissect_options *ndo,
     if (len < 4) {
         return hexdump;
     }
-    subtype = *(pptr+3);
+    subtype = EXTRACT_8BITS(pptr + 3);
 
     ND_PRINT((ndo, "\n\t  %s Subtype (%u)",
            tok2str(lldp_dcbx_subtype_values, "unknown", subtype),
@@ -1218,7 +1218,7 @@ lldp_private_dcbx_print(netdissect_options *ndo,
            ND_PRINT((ndo, "\n\t      Oper_Version: %d", *tptr));
            ND_PRINT((ndo, "\n\t      Max_Version: %d", *(tptr + 1)));
            ND_PRINT((ndo, "\n\t      Info block(0x%02X): ", *(tptr + 2)));
-           tval = *(tptr+2);
+           tval = EXTRACT_8BITS(tptr + 2);
            ND_PRINT((ndo, "Enable bit: %d, Willing bit: %d, Error Bit: %d",
                (tval &  0x80) ? 1 : 0, (tval &  0x40) ? 1 : 0,
                (tval &  0x20) ? 1 : 0));
@@ -1249,12 +1249,12 @@ lldp_private_dcbx_print(netdissect_options *ndo,
            ND_PRINT((ndo, "\n\t      Oper_Version: %d", *tptr));
            ND_PRINT((ndo, "\n\t      Max_Version: %d", *(tptr + 1)));
            ND_PRINT((ndo, "\n\t      Info block(0x%02X): ", *(tptr + 2)));
-           tval = *(tptr+2);
+           tval = EXTRACT_8BITS(tptr + 2);
            ND_PRINT((ndo, "Enable bit: %d, Willing bit: %d, Error Bit: %d",
                (tval &  0x80) ? 1 : 0, (tval &  0x40) ? 1 : 0,
                (tval &  0x20) ? 1 : 0));
            ND_PRINT((ndo, "\n\t      SubType: %d", *(tptr + 3)));
-           tval = *(tptr+4);
+           tval = EXTRACT_8BITS(tptr + 4);
            ND_PRINT((ndo, "\n\t      PFC Config (0x%02X)", *(tptr + 4)));
            for (i = 0; i <= 7; i++)
                ND_PRINT((ndo, "\n\t          Priority Bit %d: %s",
@@ -1270,7 +1270,7 @@ lldp_private_dcbx_print(netdissect_options *ndo,
            ND_PRINT((ndo, "\n\t      Oper_Version: %d", *tptr));
            ND_PRINT((ndo, "\n\t      Max_Version: %d", *(tptr + 1)));
            ND_PRINT((ndo, "\n\t      Info block(0x%02X): ", *(tptr + 2)));
-           tval = *(tptr+2);
+           tval = EXTRACT_8BITS(tptr + 2);
            ND_PRINT((ndo, "Enable bit: %d, Willing bit: %d, Error Bit: %d",
                (tval &  0x80) ? 1 : 0, (tval &  0x40) ? 1 : 0,
                (tval &  0x20) ? 1 : 0));
index 9ace0e239393ad385d3a525bb37a365f77bed74e..7203d12e8474198f9c362a2d389d65ce9a77549e 100644 (file)
@@ -1103,7 +1103,7 @@ print_ipcp_config_options(netdissect_options *ndo,
                                 while (ipcomp_subopttotallen >= 2) {
                                         ND_TCHECK2(*p, 2);
                                         ipcomp_subopt = *p;
-                                        ipcomp_suboptlen = *(p+1);
+                                        ipcomp_suboptlen = EXTRACT_8BITS(p + 1);
 
                                         /* sanity check */
                                         if (ipcomp_subopt == 0 ||
index 59e5fc5a5e43e041428b993733e84d3e057adb7b..ccb51302a758ee60dec6ccdce83a9fbd6c76635b 100644 (file)
@@ -668,7 +668,7 @@ print_vendor_attr(netdissect_options *ndo,
        ND_TCHECK2(*data, 2);
 
         vendor_type = *(data);
-        vendor_length = *(data+1);
+        vendor_length = EXTRACT_8BITS(data + 1);
 
         if (vendor_length < 2)
         {
index 866e75b92486ba1019e9f31e110f7beaf2c89838..bbbd433434ed87666d13aea0ed7d0e1f06622db4 100644 (file)
@@ -98,7 +98,7 @@ rrcp_print(netdissect_options *ndo,
        uint8_t rrcp_opcode;
 
        ND_TCHECK(*(cp + RRCP_PROTO_OFFSET));
-       rrcp_proto = *(cp + RRCP_PROTO_OFFSET);
+       rrcp_proto = EXTRACT_8BITS(cp + RRCP_PROTO_OFFSET);
        ND_TCHECK(*(cp + RRCP_OPCODE_ISREPLY_OFFSET));
        rrcp_opcode = EXTRACT_8BITS((cp + RRCP_OPCODE_ISREPLY_OFFSET)) & RRCP_OPCODE_MASK;
        if (src != NULL && dst != NULL) {
index b37fe5952c535c98e7e5d52f0c7d4f648ab6eebb..b511c29e1129e3e099434cf335f401187d33d562 100644 (file)
@@ -1069,7 +1069,7 @@ rsvp_obj_print(netdissect_options *ndo,
                    u_char length;
 
                    ND_TCHECK2(*obj_tptr, 4);
-                   length = *(obj_tptr + 1);
+                   length = EXTRACT_8BITS(obj_tptr + 1);
                     ND_PRINT((ndo, "%s  Subobject Type: %s, length %u",
                            indent,
                            tok2str(rsvp_obj_xro_values,
@@ -1091,7 +1091,7 @@ rsvp_obj_print(netdissect_options *ndo,
                                goto invalid;
                        }
                        ND_TCHECK2(*obj_tptr, 8);
-                       prefix_length = *(obj_tptr+6);
+                       prefix_length = EXTRACT_8BITS(obj_tptr + 6);
                        if (prefix_length != 32) {
                                ND_PRINT((ndo, " ERROR: Prefix length %u != 32",
                                          prefix_length));
@@ -1122,8 +1122,8 @@ rsvp_obj_print(netdissect_options *ndo,
                                EXTRACT_8BITS((obj_tptr + 3)),
                                EXTRACT_BE_32BITS(obj_tptr + 4)));
                     }
-                    obj_tlen-=*(obj_tptr+1);
-                    obj_tptr+=*(obj_tptr+1);
+                    obj_tlen-=EXTRACT_8BITS(obj_tptr + 1);
+                    obj_tptr+=EXTRACT_8BITS(obj_tptr + 1);
                 }
                 break;
             default:
@@ -1171,7 +1171,7 @@ rsvp_obj_print(netdissect_options *ndo,
             case RSVP_CTYPE_TUNNEL_IPV4:
                 if (obj_tlen < 4)
                     return-1;
-                namelen = *(obj_tptr+3);
+                namelen = EXTRACT_8BITS(obj_tptr + 3);
                 if (obj_tlen < 4+namelen)
                     return-1;
                 ND_PRINT((ndo, "%s  Session Name: ", indent));
@@ -1571,7 +1571,7 @@ rsvp_obj_print(netdissect_options *ndo,
             case RSVP_CTYPE_IPV4:
                 if (obj_tlen < 8)
                     return-1;
-                error_code=*(obj_tptr+5);
+                error_code=EXTRACT_8BITS(obj_tptr + 5);
                 error_value=EXTRACT_BE_16BITS(obj_tptr + 6);
                 ND_PRINT((ndo, "%s  Error Node Address: %s, Flags: [0x%02x]%s  Error Code: %s (%u)",
                        indent,
@@ -1603,7 +1603,7 @@ rsvp_obj_print(netdissect_options *ndo,
             case RSVP_CTYPE_IPV6:
                 if (obj_tlen < 20)
                     return-1;
-                error_code=*(obj_tptr+17);
+                error_code=EXTRACT_8BITS(obj_tptr + 17);
                 error_value=EXTRACT_BE_16BITS(obj_tptr + 18);
                 ND_PRINT((ndo, "%s  Error Node Address: %s, Flags: [0x%02x]%s  Error Code: %s (%u)",
                        indent,
@@ -1654,8 +1654,8 @@ rsvp_obj_print(netdissect_options *ndo,
                     if (*(obj_tptr+1) < 2)
                         return -1;
                     print_unknown_data(ndo, obj_tptr + 2, "\n\t\t", *(obj_tptr + 1) - 2);
-                    obj_tlen-=*(obj_tptr+1);
-                    obj_tptr+=*(obj_tptr+1);
+                    obj_tlen-=EXTRACT_8BITS(obj_tptr + 1);
+                    obj_tptr+=EXTRACT_8BITS(obj_tptr + 1);
                 }
                 break;
             default:
index 0c07293ae0e3d384934459716b903b257ae3ea14..fbde2c368546fde6782b3e1f791f30c318941c61 100644 (file)
@@ -130,7 +130,7 @@ vtp_print (netdissect_options *ndo,
 
     ND_TCHECK2(*tptr, VTP_HEADER_LEN);
 
-    type = *(tptr+1);
+    type = EXTRACT_8BITS(tptr + 1);
     ND_PRINT((ndo, "VTPv%u, Message %s (0x%02x), length %u",
           *tptr,
           tok2str(vtp_message_type_values,"Unknown message type", type),
@@ -144,7 +144,7 @@ vtp_print (netdissect_options *ndo,
 
     /* verbose mode print all fields */
     ND_PRINT((ndo, "\n\tDomain name: "));
-    mgmtd_len = *(tptr + 3);
+    mgmtd_len = EXTRACT_8BITS(tptr + 3);
     if (mgmtd_len < 1 ||  mgmtd_len > 32) {
        ND_PRINT((ndo, " [invalid MgmtD Len %d]", mgmtd_len));
        return;
@@ -288,7 +288,7 @@ vtp_print (netdissect_options *ndo,
                     goto trunc;
                 ND_TCHECK2(*tptr, 2);
                 type = *tptr;
-                tlv_len = *(tptr+1);
+                tlv_len = EXTRACT_8BITS(tptr + 1);
 
                 ND_PRINT((ndo, "\n\t\t%s (0x%04x) TLV",
                        tok2str(vtp_vlan_tlv_values, "Unknown", type),