From: Francois-Xavier Le Bail Date: Tue, 21 Nov 2017 21:53:05 +0000 (+0100) Subject: Use more the EXTRACT_8BITS() macro to fetch a one-byte value (19/n) X-Git-Tag: tcpdump-4.99-bp~1734 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/d0be8661252cce1a8f7d15aa37aa0306e31947de Use more the EXTRACT_8BITS() macro to fetch a one-byte value (19/n) Assignment, *p++ -> EXTRACT_8BITS(p); p++; Assignment, *(p++) -> EXTRACT_8BITS(p); p++; Partial list. --- diff --git a/print-egp.c b/print-egp.c index 29f653b3..51d78599 100644 --- a/print-egp.c +++ b/print-egp.c @@ -166,7 +166,8 @@ egpnrprint(netdissect_options *ndo, switch (netlen) { case 1: - addr = *cp++; + addr = EXTRACT_8BITS(cp); + cp++; /* fall through */ case 2: addr = (addr << 8) | *cp++; @@ -179,7 +180,8 @@ egpnrprint(netdissect_options *ndo, if (length < 1) goto trunc; ND_TCHECK2(cp[0], 1); - distances = *cp++; + distances = EXTRACT_8BITS(cp); + cp++; length--; ND_PRINT((ndo, " %s %s ", gateways < (int)egp->egp_intgw ? "int" : "ext", @@ -193,7 +195,8 @@ egpnrprint(netdissect_options *ndo, ND_TCHECK2(cp[0], 2); ND_PRINT((ndo, "%sd%d:", comma, (int)*cp++)); comma = ", "; - networks = *cp++; + networks = EXTRACT_8BITS(cp); + cp++; length -= 2; while (--networks >= 0) { /* Pickup network number */ diff --git a/print-juniper.c b/print-juniper.c index d9c45200..cb08dc0f 100644 --- a/print-juniper.c +++ b/print-juniper.c @@ -1234,8 +1234,10 @@ juniper_parse_header(netdissect_options *ndo, ND_TCHECK2(tptr[0], jnx_ext_len); while (jnx_ext_len > JUNIPER_EXT_TLV_OVERHEAD) { - tlv_type = *(tptr++); - tlv_len = *(tptr++); + tlv_type = EXTRACT_8BITS(tptr); + tptr++; + tlv_len = EXTRACT_8BITS(tptr); + tptr++; tlv_value = 0; /* sanity checks */