]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-isakmp.c
Use more the EXTRACT_U_1() macro (43/n)
[tcpdump] / print-isakmp.c
index fa9fa23978c6375d149c8cd00c21441e745a2b11..e55636318b071e9452563261561a156cb7d65666 100644 (file)
@@ -944,14 +944,14 @@ ikev1_attrmap_print(netdissect_options *ndo,
                if (map && t < nmap && v < map[t].nvalue && map[t].value[v])
                        ND_PRINT((ndo,"%s", map[t].value[v]));
                else {
-                       if (!rawprint(ndo, (const uint8_t *)&p[2], 2)) {
+                       if (!rawprint(ndo, (const uint8_t *)(p + 2), 2)) {
                                ND_PRINT((ndo,")"));
                                goto trunc;
                        }
                }
        } else {
                ND_PRINT((ndo,"len=%d value=", totlen - 4));
-               if (!rawprint(ndo, (const uint8_t *)&p[4], totlen - 4)) {
+               if (!rawprint(ndo, (const uint8_t *)(p + 4), totlen - 4)) {
                        ND_PRINT((ndo,")"));
                        goto trunc;
                }
@@ -988,13 +988,13 @@ ikev1_attr_print(netdissect_options *ndo, const u_char *p, const u_char *ep2)
        if (p[0] & 0x80) {
                ND_PRINT((ndo,"value="));
                t = p[2];
-               if (!rawprint(ndo, (const uint8_t *)&p[2], 2)) {
+               if (!rawprint(ndo, (const uint8_t *)(p + 2), 2)) {
                        ND_PRINT((ndo,")"));
                        goto trunc;
                }
        } else {
                ND_PRINT((ndo,"len=%d value=", totlen - 4));
-               if (!rawprint(ndo, (const uint8_t *)&p[4], totlen - 4)) {
+               if (!rawprint(ndo, (const uint8_t *)(p + 4), totlen - 4)) {
                        ND_PRINT((ndo,")"));
                        goto trunc;
                }
@@ -3096,7 +3096,7 @@ isakmp_rfc3948_print(netdissect_options *ndo,
                     const u_char *bp2)
 {
        ND_TCHECK(bp[0]);
-       if(length == 1 && bp[0]==0xff) {
+       if(length == 1 && EXTRACT_U_1(bp)==0xff) {
                ND_PRINT((ndo, "isakmp-nat-keep-alive"));
                return;
        }
@@ -3109,7 +3109,8 @@ isakmp_rfc3948_print(netdissect_options *ndo,
        /*
         * see if this is an IKE packet
         */
-       if(bp[0]==0 && bp[1]==0 && bp[2]==0 && bp[3]==0) {
+       if (EXTRACT_U_1(bp) == 0 && EXTRACT_U_1(bp + 1) == 0 &&
+           EXTRACT_U_1(bp + 2) == 0 && EXTRACT_U_1(bp + 3) == 0) {
                ND_PRINT((ndo, "NONESP-encap: "));
                isakmp_print(ndo, bp+4, length-4, bp2);
                return;