diff options
author | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2017-12-04 22:45:01 +0100 |
---|---|---|
committer | Francois-Xavier Le Bail <devel.fx.lebail@orange.fr> | 2017-12-05 10:45:44 +0100 |
commit | 03a2d9c4c1e360def4f9d0473f9b378ef2f14431 (patch) | |
tree | a4c461c32a90c3b7b671c0b15edc70ac18be5a36 | |
parent | 7e3467df250235e68fea65320a89a5116da85be2 (diff) | |
download | tcpdump-03a2d9c4c1e360def4f9d0473f9b378ef2f14431.tar.gz |
Use more the EXTRACT_U_1() macro (47/n)
In: if (... *(p) ...) ...
-rw-r--r-- | print-ahcp.c | 2 | ||||
-rw-r--r-- | print-arp.c | 2 | ||||
-rw-r--r-- | print-ascii.c | 3 | ||||
-rw-r--r-- | print-atm.c | 2 | ||||
-rw-r--r-- | print-llc.c | 2 | ||||
-rw-r--r-- | print-msdp.c | 2 | ||||
-rw-r--r-- | print-radius.c | 2 | ||||
-rw-r--r-- | print-resp.c | 6 | ||||
-rw-r--r-- | print-rpki-rtr.c | 2 | ||||
-rw-r--r-- | print-sl.c | 6 | ||||
-rw-r--r-- | print-snmp.c | 6 | ||||
-rw-r--r-- | print-telnet.c | 2 | ||||
-rw-r--r-- | print-tftp.c | 4 | ||||
-rw-r--r-- | smbutil.c | 2 |
14 files changed, 23 insertions, 20 deletions
diff --git a/print-ahcp.c b/print-ahcp.c index 06002903..8dfe9d16 100644 --- a/print-ahcp.c +++ b/print-ahcp.c @@ -355,7 +355,7 @@ ahcp_print(netdissect_options *ndo, const u_char *cp, const u_int len) goto invalid; /* Magic */ ND_TCHECK_1(cp); - if (*cp != AHCP_MAGIC_NUMBER) + if (EXTRACT_U_1(cp) != AHCP_MAGIC_NUMBER) goto invalid; cp += 1; /* Version */ diff --git a/print-arp.c b/print-arp.c index 7c57870a..dc8bf23f 100644 --- a/print-arp.c +++ b/print-arp.c @@ -181,7 +181,7 @@ static int isnonzero(const u_char *a, size_t len) { while (len > 0) { - if (*a != 0) + if (EXTRACT_U_1(a) != 0) return (1); a++; len--; diff --git a/print-ascii.c b/print-ascii.c index 4ef38a17..151e5c28 100644 --- a/print-ascii.c +++ b/print-ascii.c @@ -46,6 +46,7 @@ #include <stdio.h> #include "netdissect.h" +#include "extract.h" #define ASCII_LINELENGTH 300 #define HEXDUMP_BYTES_PER_LINE 16 @@ -78,7 +79,7 @@ ascii_print(netdissect_options *ndo, * * In the middle of a line, just print a '.'. */ - if (length > 1 && *cp != '\n') + if (length > 1 && EXTRACT_U_1(cp) != '\n') ND_PRINT((ndo, ".")); } else { if (!ND_ISGRAPH(s) && diff --git a/print-atm.c b/print-atm.c index 27106b46..ed29c6d5 100644 --- a/print-atm.c +++ b/print-atm.c @@ -259,7 +259,7 @@ atm_if_print(netdissect_options *ndo, } /* Cisco Style NLPID ? */ - if (*p == LLC_UI) { + if (EXTRACT_U_1(p) == LLC_UI) { if (ndo->ndo_eflag) ND_PRINT((ndo, "CNLPID ")); isoclns_print(ndo, p + 1, length - 1); diff --git a/print-llc.c b/print-llc.c index 3673ef8d..d73ac847 100644 --- a/print-llc.c +++ b/print-llc.c @@ -372,7 +372,7 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen, ND_DEFAULTPRINT((const u_char *)p, caplen); return (hdrlen); } - if (*p == LLC_XID_FI) { + if (EXTRACT_U_1(p) == LLC_XID_FI) { if (caplen < 3 || length < 3) { ND_PRINT((ndo, "[|llc]")); if (caplen > 0) diff --git a/print-msdp.c b/print-msdp.c index e2ffde1b..df59b463 100644 --- a/print-msdp.c +++ b/print-msdp.c @@ -61,7 +61,7 @@ msdp_print(netdissect_options *ndo, const u_char *sp, u_int length) ND_PRINT((ndo, " SA-Response")); ND_TCHECK_1(sp); ND_PRINT((ndo, " %u entries", EXTRACT_U_1(sp))); - if ((u_int)((*sp * 12) + 8) < len) { + if ((u_int)((EXTRACT_U_1(sp) * 12) + 8) < len) { ND_PRINT((ndo, " [w/data]")); if (ndo->ndo_vflag > 1) { ND_PRINT((ndo, " ")); diff --git a/print-radius.c b/print-radius.c index 5ce68d16..cb170170 100644 --- a/print-radius.c +++ b/print-radius.c @@ -609,7 +609,7 @@ print_attr_string(netdissect_options *ndo, case TUNNEL_ASSIGN_ID: case TUNNEL_CLIENT_AUTH: case TUNNEL_SERVER_AUTH: - if (*data <= 0x1F) + if (EXTRACT_U_1(data) <= 0x1F) { if (length < 1) goto trunc; diff --git a/print-resp.c b/print-resp.c index c2b6e63a..71b198fd 100644 --- a/print-resp.c +++ b/print-resp.c @@ -467,7 +467,7 @@ resp_get_length(netdissect_options *ndo, register const u_char *bp, int len, con ND_TCHECK_1(bp); too_large = 0; neg = 0; - if (*bp == '-') { + if (EXTRACT_U_1(bp) == '-') { neg = 1; bp++; len--; @@ -508,7 +508,7 @@ resp_get_length(netdissect_options *ndo, register const u_char *bp, int len, con * OK, we found a non-digit character. It should be a \r, followed * by a \n. */ - if (*bp != '\r') { + if (EXTRACT_U_1(bp) != '\r') { bp++; goto invalid; } @@ -517,7 +517,7 @@ resp_get_length(netdissect_options *ndo, register const u_char *bp, int len, con if (len == 0) goto trunc; ND_TCHECK_1(bp); - if (*bp != '\n') { + if (EXTRACT_U_1(bp) != '\n') { bp++; goto invalid; } diff --git a/print-rpki-rtr.c b/print-rpki-rtr.c index 1af8e863..4e2e7c14 100644 --- a/print-rpki-rtr.c +++ b/print-rpki-rtr.c @@ -183,7 +183,7 @@ rpki_rtr_pdu_print (netdissect_options *ndo, const u_char *tptr, const u_int len /* Protocol Version */ ND_TCHECK_1(tptr); - if (*tptr != 0) { + if (EXTRACT_U_1(tptr) != 0) { /* Skip the rest of the input buffer because even if this is * a well-formed PDU of a future RPKI-Router protocol version * followed by a well-formed PDU of RPKI-Router protocol @@ -198,7 +198,8 @@ print_sl_change(netdissect_options *ndo, { register u_int i; - if ((i = *cp++) == 0) { + if ((i = EXTRACT_U_1(cp)) == 0) { + cp++; i = EXTRACT_BE_U_2(cp); cp += 2; } @@ -212,7 +213,8 @@ print_sl_winchange(netdissect_options *ndo, { register short i; - if ((i = *cp++) == 0) { + if ((i = EXTRACT_U_1(cp)) == 0) { + cp++; i = EXTRACT_BE_U_2(cp); cp += 2; } diff --git a/print-snmp.c b/print-snmp.c index 0c90132b..e7b64aee 100644 --- a/print-snmp.c +++ b/print-snmp.c @@ -543,7 +543,7 @@ asn1_parse(netdissect_options *ndo, ND_PRINT((ndo, "[asnlen=0]")); return -1; } - if (*p & ASN_BIT8) /* negative */ + if (EXTRACT_U_1(p) & ASN_BIT8) /* negative */ data = -1; for (i = elem->asnlen; i-- > 0; p++) data = (data << ASN_SHIFT8) | EXTRACT_U_1(p); @@ -772,7 +772,7 @@ asn1_print(netdissect_options *ndo, for (; i-- > 0; p++) { ND_TCHECK_1(p); o = (o << ASN_SHIFT7) + (*p & ~ASN_BIT8); - if (*p & ASN_LONGLEN) + if (EXTRACT_U_1(p) & ASN_LONGLEN) continue; /* @@ -924,7 +924,7 @@ smi_decode_oid(netdissect_options *ndo, for (*oidlen = 0; i-- > 0; p++) { ND_TCHECK_1(p); o = (o << ASN_SHIFT7) + (*p & ~ASN_BIT8); - if (*p & ASN_LONGLEN) + if (EXTRACT_U_1(p) & ASN_LONGLEN) continue; /* diff --git a/print-telnet.c b/print-telnet.c index bbc4f231..41e24462 100644 --- a/print-telnet.c +++ b/print-telnet.c @@ -444,7 +444,7 @@ telnet_parse(netdissect_options *ndo, const u_char *sp, u_int length, int print) p++; } ND_TCHECK_1(p); - if (*p != IAC) + if (EXTRACT_U_1(p) != IAC) goto pktend; switch (x) { diff --git a/print-tftp.c b/print-tftp.c index c0b13384..5ebf9333 100644 --- a/print-tftp.c +++ b/print-tftp.c @@ -140,7 +140,7 @@ tftp_print(netdissect_options *ndo, /* Print options, if any */ while (length != 0) { ND_TCHECK_1(bp); - if (*bp != '\0') + if (EXTRACT_U_1(bp) != '\0') ND_PRINT((ndo, " ")); ui = fn_printztn(ndo, bp, length, ndo->ndo_snapend); if (ui == 0) @@ -154,7 +154,7 @@ tftp_print(netdissect_options *ndo, /* Print options */ while (length != 0) { ND_TCHECK_1(bp); - if (*bp != '\0') + if (EXTRACT_U_1(bp) != '\0') ND_PRINT((ndo, " ")); ui = fn_printztn(ndo, bp, length, ndo->ndo_snapend); if (ui == 0) @@ -637,7 +637,7 @@ smb_fdata1(netdissect_options *ndo, uint32_t len; ND_TCHECK_1(buf); - if (*buf != 4 && *buf != 2) { + if (EXTRACT_U_1(buf) != 4 && EXTRACT_U_1(buf) != 2) { ND_PRINT((ndo, "Error! ASCIIZ buffer of type %u", EXTRACT_U_1(buf))); return maxbuf; /* give up */ } |