From: Francois-Xavier Le Bail Date: Sun, 3 Dec 2017 10:13:27 +0000 (+0100) Subject: Simplify some expressions X-Git-Tag: tcpdump-4.99-bp~1682 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/a5bb53dd7407207c012d901789d68e4b8a7054cf Simplify some expressions --- diff --git a/print-isakmp.c b/print-isakmp.c index fa9fa239..af9532dd 100644 --- a/print-isakmp.c +++ b/print-isakmp.c @@ -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; } diff --git a/print-smb.c b/print-smb.c index af775370..2f5074c2 100644 --- a/print-smb.c +++ b/print-smb.c @@ -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);