]> The Tcpdump Group git mirrors - tcpdump/commitdiff
More EXTRACT_U_1() replacing direct dereferences.
authorGuy Harris <[email protected]>
Sat, 9 Dec 2017 01:57:39 +0000 (17:57 -0800)
committerGuy Harris <[email protected]>
Sat, 9 Dec 2017 01:57:39 +0000 (17:57 -0800)
print-nsh.c
print-otv.c
print-resp.c

index 6abf9f17c48aba545aee1c1a6324e05328ffbfd6..b064482323a81f95c7011eed6f0f57280fbf9382 100644 (file)
@@ -68,18 +68,18 @@ nsh_print(netdissect_options *ndo, const u_char *bp, u_int len)
 
     ND_TCHECK2(*bp, NSH_BASE_HDR_LEN + NSH_SERVICE_PATH_HDR_LEN);
 
-    ver = (uint8_t)(*bp >> 6);
-    flags = *bp;
+    ver = (uint8_t)(EXTRACT_U_1(bp) >> 6);
+    flags = EXTRACT_U_1(bp);
     bp += 1;
-    length = *bp;
+    length = EXTRACT_U_1(bp);
     bp += 1;
-    md_type = *bp;
+    md_type = EXTRACT_U_1(bp);
     bp += 1;
-    next_protocol = *bp;
+    next_protocol = EXTRACT_U_1(bp);
     bp += 1;
     service_path_id = EXTRACT_BE_U_3(bp);
     bp += 3;
-    service_index = *bp;
+    service_index = EXTRACT_U_1(bp);
     bp += 1;
 
     ND_PRINT((ndo, "NSH, "));
@@ -127,9 +127,9 @@ nsh_print(netdissect_options *ndo, const u_char *bp, u_int len)
             while (n < length - 2) {
                 tlv_class = EXTRACT_BE_U_2(bp);
                 bp += 2;
-                tlv_type  = *bp;
+                tlv_type  = EXTRACT_U_1(bp);
                 bp += 1;
-                tlv_len   = *bp;
+                tlv_len   = EXTRACT_U_1(bp);
                 bp += 1;
 
                 ND_PRINT((ndo, "\n        TLV Class %d, Type %d, Len %d",
index d7b062bce398f91dead68defc88a6030af832410..502f93e419810c0aea6c68c85c48b5d4bdee4dcd 100644 (file)
@@ -50,7 +50,7 @@ otv_print(netdissect_options *ndo, const u_char *bp, u_int len)
         goto trunc;
 
     ND_TCHECK_1(bp);
-    flags = *bp;
+    flags = EXTRACT_U_1(bp);
     ND_PRINT((ndo, "flags [%s] (0x%02x), ", flags & 0x08 ? "I" : ".", flags));
     bp += 1;
 
index 71b198fd5cead9e871eac77ee5baccee33ce9cfb..64484601f5db2adf9cd4b64ea48124bfb25d4dc9 100644 (file)
@@ -248,7 +248,7 @@ resp_parse(netdissect_options *ndo, register const u_char *bp, int length)
 
     LCHECK2(length, 1);
     ND_TCHECK_1(bp);
-    op = *bp;
+    op = EXTRACT_U_1(bp);
 
     /* bp now points to the op, so these routines must skip it */
     switch(op) {
@@ -479,7 +479,7 @@ resp_get_length(netdissect_options *ndo, register const u_char *bp, int len, con
         if (len == 0)
             goto trunc;
         ND_TCHECK_1(bp);
-        c = *bp;
+        c = EXTRACT_U_1(bp);
         if (!(c >= '0' && c <= '9')) {
             if (!saw_digit) {
                 bp++;