]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Simplify some expressions
authorFrancois-Xavier Le Bail <[email protected]>
Sun, 3 Dec 2017 10:13:27 +0000 (11:13 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Sun, 3 Dec 2017 10:13:27 +0000 (11:13 +0100)
print-isakmp.c
print-smb.c

index fa9fa23978c6375d149c8cd00c21441e745a2b11..af9532dd402005aa858134805b858c9edb523eb5 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;
                }
index af775370ba983f3d728a1fc6a01de8fc45bcfdf1..2f5074c2e09591ce2e073285dd0676dc1c690af0 100644 (file)
@@ -1304,7 +1304,7 @@ nbt_udp138_print(netdissect_options *ndo,
 
     if (data != NULL) {
        /* If there isn't enough data for "\377SMB", don't check for it. */
-       if (&data[3] >= maxbuf)
+       if ((data + 3) >= maxbuf)
            goto out;
 
        if (memcmp(data, "\377SMB",4) == 0)
@@ -1442,7 +1442,7 @@ netbeui_print(netdissect_options *ndo,
        goto out;
 
     /* If there isn't enough data for "\377SMB", don't look for it. */
-    if (&data2[3] >= maxbuf)
+    if ((data2 + 3) >= maxbuf)
        goto out;
 
     if (memcmp(data2, "\377SMB",4) == 0)
@@ -1450,7 +1450,7 @@ netbeui_print(netdissect_options *ndo,
     else {
        int i;
        for (i = 0; i < 128; i++) {
-           if (&data2[i + 3] >= maxbuf)
+           if ((data2 + i + 3) >= maxbuf)
                break;
            if (memcmp(data2 + i, "\377SMB", 4) == 0) {
                ND_PRINT((ndo, "found SMB packet at %d\n", i));
@@ -1488,7 +1488,7 @@ ipx_netbios_print(netdissect_options *ndo,
        maxbuf = ndo->ndo_snapend;
     startbuf = data;
     for (i = 0; i < 128; i++) {
-       if (&data[i + 4] > maxbuf)
+       if ((data + i + 4) > maxbuf)
            break;
        if (memcmp(data + i, "\377SMB", 4) == 0) {
            smb_fdata(ndo, data, "\n>>> IPX transport ", data + i, 0);