diff options
-rw-r--r-- | print-802_11.c | 10 | ||||
-rw-r--r-- | print-atm.c | 2 | ||||
-rw-r--r-- | print-babel.c | 20 | ||||
-rw-r--r-- | print-bfd.c | 4 | ||||
-rw-r--r-- | print-bgp.c | 12 | ||||
-rw-r--r-- | print-carp.c | 2 | ||||
-rw-r--r-- | print-cdp.c | 4 | ||||
-rw-r--r-- | print-dhcp6.c | 14 | ||||
-rw-r--r-- | print-hncp.c | 6 | ||||
-rw-r--r-- | print-icmp6.c | 2 | ||||
-rw-r--r-- | print-ip.c | 8 | ||||
-rw-r--r-- | print-ip6opts.c | 14 | ||||
-rw-r--r-- | print-isakmp.c | 13 | ||||
-rw-r--r-- | print-juniper.c | 2 | ||||
-rw-r--r-- | print-l2tp.c | 2 | ||||
-rw-r--r-- | print-llc.c | 4 | ||||
-rw-r--r-- | print-lldp.c | 14 | ||||
-rw-r--r-- | print-mobility.c | 4 | ||||
-rw-r--r-- | print-pim.c | 62 | ||||
-rw-r--r-- | print-radius.c | 4 | ||||
-rw-r--r-- | print-sl.c | 6 | ||||
-rw-r--r-- | print-smb.c | 3 | ||||
-rw-r--r-- | print-stp.c | 26 | ||||
-rw-r--r-- | print-sunatm.c | 2 | ||||
-rw-r--r-- | print-tcp.c | 16 | ||||
-rw-r--r-- | print-vrrp.c | 4 |
26 files changed, 136 insertions, 124 deletions
diff --git a/print-802_11.c b/print-802_11.c index 67300ee6..a1c5b58a 100644 --- a/print-802_11.c +++ b/print-802_11.c @@ -1590,9 +1590,9 @@ handle_action(netdissect_options *ndo, ND_PRINT((ndo, " (%s): ", etheraddr_string(ndo, src))); } switch (p[0]) { - case 0: ND_PRINT((ndo, "Spectrum Management Act#%d", p[1])); break; - case 1: ND_PRINT((ndo, "QoS Act#%d", p[1])); break; - case 2: ND_PRINT((ndo, "DLS Act#%d", p[1])); break; + case 0: ND_PRINT((ndo, "Spectrum Management Act#%d", EXTRACT_U_1(p + 1))); break; + case 1: ND_PRINT((ndo, "QoS Act#%d", EXTRACT_U_1(p + 1))); break; + case 2: ND_PRINT((ndo, "DLS Act#%d", EXTRACT_U_1(p + 1))); break; case 3: ND_PRINT((ndo, "BA ")); PRINT_BA_ACTION(p[1]); break; case 7: ND_PRINT((ndo, "HT ")); PRINT_HT_ACTION(p[1]); break; case 13: ND_PRINT((ndo, "MeshAction ")); PRINT_MESH_ACTION(p[1]); break; @@ -1602,9 +1602,9 @@ handle_action(netdissect_options *ndo, case 15: ND_PRINT((ndo, "SelfprotectAction ")); PRINT_SELFPROT_ACTION(p[1]); break; - case 127: ND_PRINT((ndo, "Vendor Act#%d", p[1])); break; + case 127: ND_PRINT((ndo, "Vendor Act#%d", EXTRACT_U_1(p + 1))); break; default: - ND_PRINT((ndo, "Reserved(%d) Act#%d", p[0], p[1])); + ND_PRINT((ndo, "Reserved(%d) Act#%d", EXTRACT_U_1(p), EXTRACT_U_1(p + 1))); break; } return 1; diff --git a/print-atm.c b/print-atm.c index 03c39ff0..9c4adbc1 100644 --- a/print-atm.c +++ b/print-atm.c @@ -370,7 +370,7 @@ sig_print(netdissect_options *ndo, ND_PRINT((ndo, "CALL_REF:0x%06x", call_ref)); } else { /* SSCOP with some unknown protocol atop it */ - ND_PRINT((ndo, "SSCOP, proto %d ", p[PROTO_POS])); + ND_PRINT((ndo, "SSCOP, proto %d ", EXTRACT_U_1(p + PROTO_POS))); } return; diff --git a/print-babel.c b/print-babel.c index 3c807174..c9386245 100644 --- a/print-babel.c +++ b/print-babel.c @@ -57,7 +57,7 @@ babel_print(netdissect_options *ndo, ND_PRINT((ndo, " invalid header")); return; } else { - ND_PRINT((ndo, " %d", cp[1])); + ND_PRINT((ndo, " %d", EXTRACT_U_1(cp + 1))); } switch(cp[1]) { @@ -487,9 +487,9 @@ babel_print_v2(netdissect_options *ndo, ND_PRINT((ndo, "/truncated")); else ND_PRINT((ndo, "%s%s%s", - (message[3] & 0x80) ? "/prefix": "", - (message[3] & 0x40) ? "/id" : "", - (message[3] & 0x3f) ? "/unknown" : "")); + (EXTRACT_U_1(message + 3) & 0x80) ? "/prefix": "", + (EXTRACT_U_1(message + 3) & 0x40) ? "/id" : "", + (EXTRACT_U_1(message + 3) & 0x3f) ? "/unknown" : "")); } else { u_short interval, seqno, metric; u_char plen; @@ -507,9 +507,9 @@ babel_print_v2(netdissect_options *ndo, seqno = EXTRACT_BE_U_2(message + 8); metric = EXTRACT_BE_U_2(message + 10); ND_PRINT((ndo, "%s%s%s %s metric %u seqno %u interval %s", - (message[3] & 0x80) ? "/prefix": "", - (message[3] & 0x40) ? "/id" : "", - (message[3] & 0x3f) ? "/unknown" : "", + (EXTRACT_U_1(message + 3) & 0x80) ? "/prefix": "", + (EXTRACT_U_1(message + 3) & 0x40) ? "/id" : "", + (EXTRACT_U_1(message + 3) & 0x3f) ? "/unknown" : "", format_prefix(ndo, prefix, plen), metric, seqno, format_interval_update(interval))); if(message[3] & 0x80) { @@ -538,7 +538,7 @@ babel_print_v2(netdissect_options *ndo, message + 4, NULL, len - 2, prefix); if(rc < 0) goto invalid; ND_PRINT((ndo, "for %s", - message[2] == 0 ? "any" : format_prefix(ndo, prefix, plen))); + EXTRACT_U_1(message + 2) == 0 ? "any" : format_prefix(ndo, prefix, plen))); } } break; @@ -558,7 +558,7 @@ babel_print_v2(netdissect_options *ndo, if(rc < 0) goto invalid; plen = message[3] + (message[2] == 1 ? 96 : 0); ND_PRINT((ndo, "(%u hops) for %s seqno %u id %s", - message[6], format_prefix(ndo, prefix, plen), + EXTRACT_U_1(message + 6), format_prefix(ndo, prefix, plen), seqno, format_id(message + 8))); } } @@ -582,7 +582,7 @@ babel_print_v2(netdissect_options *ndo, if(len < 18) goto invalid; ND_PRINT((ndo, "key-id %u digest-%u ", EXTRACT_BE_U_2(message + 2), len - 2)); for (j = 0; j < len - 2; j++) - ND_PRINT((ndo, "%02X", message[4 + j])); + ND_PRINT((ndo, "%02X", EXTRACT_U_1(message + j + 4))); } } break; diff --git a/print-bfd.c b/print-bfd.c index 74030d03..feea837e 100644 --- a/print-bfd.c +++ b/print-bfd.c @@ -248,7 +248,7 @@ auth_print(netdissect_options *ndo, register const u_char *pptr) ND_TCHECK2(*pptr, AUTH_MD5_HASH_LEN); ND_PRINT((ndo, "\n\t Digest: ")); for(i = 0; i < AUTH_MD5_HASH_LEN; i++) - ND_PRINT((ndo, "%02x", pptr[i])); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(pptr + i))); break; case AUTH_SHA1: case AUTH_MET_SHA1: @@ -279,7 +279,7 @@ auth_print(netdissect_options *ndo, register const u_char *pptr) ND_TCHECK2(*pptr, AUTH_SHA1_HASH_LEN); ND_PRINT((ndo, "\n\t Hash: ")); for(i = 0; i < AUTH_SHA1_HASH_LEN; i++) - ND_PRINT((ndo, "%02x", pptr[i])); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(pptr + i))); break; } return 0; diff --git a/print-bgp.c b/print-bgp.c index c225f6eb..a4cf664b 100644 --- a/print-bgp.c +++ b/print-bgp.c @@ -1743,7 +1743,7 @@ bgp_attr_print(netdissect_options *ndo, ND_PRINT((ndo, "\n\t %u SNPA", snpa)); for (/*nothing*/; snpa > 0; snpa--) { ND_TCHECK(tptr[0]); - ND_PRINT((ndo, "\n\t %d bytes", tptr[0])); + ND_PRINT((ndo, "\n\t %d bytes", EXTRACT_U_1(tptr))); tptr += tptr[0] + 1; } } else { @@ -2361,11 +2361,11 @@ bgp_capabilities_print(netdissect_options *ndo, EXTRACT_BE_U_2(opt + i + 2), tok2str(bgp_safi_values, "Unknown", EXTRACT_U_1(opt + i + 5)), - opt[i+5])); + EXTRACT_U_1(opt + i + 5))); break; case BGP_CAPCODE_RESTART: ND_PRINT((ndo, "\n\t\tRestart Flags: [%s], Restart Time %us", - ((opt[i+2])&0x80) ? "R" : "none", + ((EXTRACT_U_1(opt + i + 2))&0x80) ? "R" : "none", EXTRACT_BE_U_2(opt + i + 2)&0xfff)); tcap_len-=2; cap_offset=4; @@ -2376,8 +2376,8 @@ bgp_capabilities_print(netdissect_options *ndo, EXTRACT_BE_U_2(opt + i + cap_offset), tok2str(bgp_safi_values,"Unknown", EXTRACT_U_1(opt + i + cap_offset + 2)), - opt[i+cap_offset+2], - ((opt[i+cap_offset+3])&0x80) ? "yes" : "no" )); + EXTRACT_U_1(opt + (i + cap_offset + 2)), + ((EXTRACT_U_1(opt + (i + cap_offset + 3)))&0x80) ? "yes" : "no" )); tcap_len-=4; cap_offset+=4; } @@ -2411,7 +2411,7 @@ bgp_capabilities_print(netdissect_options *ndo, tok2str(af_values,"Unknown",EXTRACT_BE_U_2(opt + i + cap_offset)), EXTRACT_BE_U_2(opt + i + cap_offset), tok2str(bgp_safi_values,"Unknown",EXTRACT_U_1(opt + i + cap_offset + 2)), - opt[i+cap_offset+2], + EXTRACT_U_1(opt + (i + cap_offset + 2)), tok2str(bgp_add_path_recvsend,"Bogus (0x%02x)",EXTRACT_U_1(opt + i + cap_offset + 3)) )); tcap_len-=4; diff --git a/print-carp.c b/print-carp.c index 9c7ba4ad..45ed4f0f 100644 --- a/print-carp.c +++ b/print-carp.c @@ -66,7 +66,7 @@ carp_print(netdissect_options *ndo, register const u_char *bp, register u_int le ND_TCHECK(bp[2]); ND_TCHECK(bp[5]); ND_PRINT((ndo, "vhid=%d advbase=%d advskew=%d authlen=%d ", - bp[1], bp[5], bp[2], bp[3])); + EXTRACT_U_1(bp + 1), EXTRACT_U_1(bp + 5), EXTRACT_U_1(bp + 2), EXTRACT_U_1(bp + 3))); if (ndo->ndo_vflag) { struct cksum_vec vec[1]; vec[0].ptr = (const uint8_t *)bp; diff --git a/print-cdp.c b/print-cdp.c index dc75f8eb..77c51358 100644 --- a/print-cdp.c +++ b/print-cdp.c @@ -381,7 +381,9 @@ cdp_print_prefixes(netdissect_options *ndo, ND_PRINT((ndo, " IPv4 Prefixes (%d):", l / 5)); while (l > 0) { - ND_PRINT((ndo, " %u.%u.%u.%u/%u", p[0], p[1], p[2], p[3], p[4])); + ND_PRINT((ndo, " %u.%u.%u.%u/%u", + EXTRACT_U_1(p), EXTRACT_U_1(p + 1), EXTRACT_U_1(p + 2), + EXTRACT_U_1(p + 3), EXTRACT_U_1(p + 4))); l -= 5; p += 5; } diff --git a/print-dhcp6.c b/print-dhcp6.c index 2894ea8d..e6986da0 100644 --- a/print-dhcp6.c +++ b/print-dhcp6.c @@ -325,7 +325,7 @@ dhcp6opt_print(netdissect_options *ndo, EXTRACT_BE_U_2(tp + 2), EXTRACT_BE_U_4(tp + 4))); for (i = 8; i < optlen; i++) - ND_PRINT((ndo, "%02x", tp[i])); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(tp + i))); /*(*/ ND_PRINT((ndo, ")")); } else { @@ -337,7 +337,7 @@ dhcp6opt_print(netdissect_options *ndo, if (optlen >= 2 + 8) { ND_PRINT((ndo, " vid ")); for (i = 2; i < 2 + 8; i++) - ND_PRINT((ndo, "%02x", tp[i])); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(tp + i))); /*(*/ ND_PRINT((ndo, ")")); } else { @@ -350,7 +350,7 @@ dhcp6opt_print(netdissect_options *ndo, ND_PRINT((ndo, " hwaddr type %u ", EXTRACT_BE_U_2(tp + 2))); for (i = 4; i < optlen; i++) - ND_PRINT((ndo, "%02x", tp[i])); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(tp + i))); /*(*/ ND_PRINT((ndo, ")")); } else { @@ -521,7 +521,7 @@ dhcp6opt_print(netdissect_options *ndo, tp = (const u_char *)(dh6o + 1); ND_PRINT((ndo, " ")); for (i = 0; i < optlen && i < 10; i++) - ND_PRINT((ndo, "%02x", tp[i])); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(tp + i))); ND_PRINT((ndo, "...)")); break; case DH6OPT_RECONF_MSG: @@ -617,7 +617,7 @@ dhcp6opt_print(netdissect_options *ndo, break; } tp = (const u_char *)(dh6o + 1); - ND_PRINT((ndo, " %s/%d", ip6addr_string(ndo, tp + 9), tp[8])); + ND_PRINT((ndo, " %s/%d", ip6addr_string(ndo, tp + 9), EXTRACT_U_1(tp + 8))); ND_PRINT((ndo, " pltime:%u vltime:%u", EXTRACT_BE_U_4(tp), EXTRACT_BE_U_4(tp + 4))); @@ -647,7 +647,7 @@ dhcp6opt_print(netdissect_options *ndo, * Print hex dump first 10 characters. */ for (i = 4; i < optlen && i < 14; i++) - ND_PRINT((ndo, "%02x", tp[i])); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(tp + i))); ND_PRINT((ndo, "...)")); break; case DH6OPT_LQ_QUERY: @@ -694,7 +694,7 @@ dhcp6opt_print(netdissect_options *ndo, * Print hex dump first 10 characters. */ for (i = 16; i < optlen && i < 26; i++) - ND_PRINT((ndo, "%02x", tp[i])); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(tp + i))); ND_PRINT((ndo, "...)")); break; case DH6OPT_NTP_SERVER: diff --git a/print-hncp.c b/print-hncp.c index 1b5ed5d4..b0315722 100644 --- a/print-hncp.c +++ b/print-hncp.c @@ -774,9 +774,9 @@ hncp_print_rec(netdissect_options *ndo, ip_address = format_ip6addr(ndo, value); ND_PRINT((ndo, " IP-Address: %s %c%c%c ", ip_address, - (value[16] & 4) ? 'l' : '-', - (value[16] & 2) ? 'b' : '-', - (value[16] & 1) ? 's' : '-' + (EXTRACT_U_1(value + 16) & 4) ? 'l' : '-', + (EXTRACT_U_1(value + 16) & 2) ? 'b' : '-', + (EXTRACT_U_1(value + 16) & 1) ? 's' : '-' )); len = print_dns_label(ndo, value+17, bodylen-17, 1); if (len < 0) { diff --git a/print-icmp6.c b/print-icmp6.c index f7e26ec4..10ec6bee 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -1495,7 +1495,7 @@ mldv2_query_print(netdissect_options *ndo, const u_char *bp, u_int len) ND_PRINT((ndo," sflag")); } if (bp[24] & 0x07) { - ND_PRINT((ndo," robustness=%d", bp[24] & 0x07)); + ND_PRINT((ndo," robustness=%d", EXTRACT_U_1(bp + 24) & 0x07)); } if (bp[25] < 128) { qqi = bp[25]; @@ -70,7 +70,7 @@ ip_printroute(netdissect_options *ndo, ND_TCHECK(cp[2]); ptr = cp[2] - 1; if (ptr < 3 || ((ptr + 1) & 3) || ptr > length + 1) - ND_PRINT((ndo, " [bad ptr %u]", cp[2])); + ND_PRINT((ndo, " [bad ptr %u]", EXTRACT_U_1(cp + 2))); for (len = 3; len < length; len += 4) { ND_TCHECK_4(cp + len); @@ -189,7 +189,7 @@ ip_printts(netdissect_options *ndo, ptr = cp[2] - 1; len = 0; if (ptr < 4 || ((ptr - 4) & (hoplen-1)) || ptr > length + 1) - ND_PRINT((ndo, "[bad ptr %u]", cp[2])); + ND_PRINT((ndo, "[bad ptr %u]", EXTRACT_U_1(cp + 2))); ND_TCHECK(cp[3]); switch (cp[3]&0xF) { case IPOPT_TS_TSONLY: @@ -211,7 +211,7 @@ ip_printts(netdissect_options *ndo, ND_PRINT((ndo, "PRESPEC")); break; default: - ND_PRINT((ndo, "[bad ts type %d]", cp[3]&0xF)); + ND_PRINT((ndo, "[bad ts type %d]", EXTRACT_U_1(cp + 3)&0xF)); goto done; } @@ -229,7 +229,7 @@ done: ND_PRINT((ndo, "%s", ptr == len ? " ^ " : "")); if (cp[3]>>4) - ND_PRINT((ndo, " [%d hops not recorded]} ", cp[3]>>4)); + ND_PRINT((ndo, " [%d hops not recorded]} ", EXTRACT_U_1(cp + 3)>>4)); else ND_PRINT((ndo, "}")); return (0); diff --git a/print-ip6opts.c b/print-ip6opts.c index 21d8b510..4533bfab 100644 --- a/print-ip6opts.c +++ b/print-ip6opts.c @@ -72,10 +72,10 @@ ip6_sopt_print(netdissect_options *ndo, const u_char *bp, int len) break; default: if (len - i < IP6OPT_MINLEN) { - ND_PRINT((ndo, ", sopt_type %d: trunc)", bp[i])); + ND_PRINT((ndo, ", sopt_type %d: trunc)", EXTRACT_U_1(bp + i))); goto trunc; } - ND_PRINT((ndo, ", sopt_type 0x%02x: len=%d", bp[i], bp[i + 1])); + ND_PRINT((ndo, ", sopt_type 0x%02x: len=%d", EXTRACT_U_1(bp + i), EXTRACT_U_1(bp + i + 1))); break; } } @@ -122,7 +122,7 @@ ip6_opt_print(netdissect_options *ndo, const u_char *bp, int len) goto trunc; } if (bp[i + 1] != IP6OPT_RTALERT_LEN - 2) { - ND_PRINT((ndo, "(rtalert: invalid len %d)", bp[i + 1])); + ND_PRINT((ndo, "(rtalert: invalid len %d)", EXTRACT_U_1(bp + i + 1))); goto trunc; } ND_PRINT((ndo, "(rtalert: 0x%04x) ", EXTRACT_BE_U_2(bp + i + 2))); @@ -133,7 +133,7 @@ ip6_opt_print(netdissect_options *ndo, const u_char *bp, int len) goto trunc; } if (bp[i + 1] != IP6OPT_JUMBO_LEN - 2) { - ND_PRINT((ndo, "(jumbo: invalid len %d)", bp[i + 1])); + ND_PRINT((ndo, "(jumbo: invalid len %d)", EXTRACT_U_1(bp + i + 1))); goto trunc; } ND_PRINT((ndo, "(jumbo: %u) ", EXTRACT_BE_U_4(bp + i + 2))); @@ -144,7 +144,7 @@ ip6_opt_print(netdissect_options *ndo, const u_char *bp, int len) goto trunc; } if (bp[i + 1] < IP6OPT_HOMEADDR_MINLEN - 2) { - ND_PRINT((ndo, "(homeaddr: invalid len %d)", bp[i + 1])); + ND_PRINT((ndo, "(homeaddr: invalid len %d)", EXTRACT_U_1(bp + i + 1))); goto trunc; } ND_PRINT((ndo, "(homeaddr: %s", ip6addr_string(ndo, bp + i + 2))); @@ -156,10 +156,10 @@ ip6_opt_print(netdissect_options *ndo, const u_char *bp, int len) break; default: if (len - i < IP6OPT_MINLEN) { - ND_PRINT((ndo, "(type %d: trunc)", bp[i])); + ND_PRINT((ndo, "(type %d: trunc)", EXTRACT_U_1(bp + i))); goto trunc; } - ND_PRINT((ndo, "(opt_type 0x%02x: len=%d)", bp[i], bp[i + 1])); + ND_PRINT((ndo, "(opt_type 0x%02x: len=%d)", EXTRACT_U_1(bp + i), EXTRACT_U_1(bp + i + 1))); break; } } diff --git a/print-isakmp.c b/print-isakmp.c index 109066c6..8244ac2d 100644 --- a/print-isakmp.c +++ b/print-isakmp.c @@ -1421,7 +1421,8 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_, mask = data + sizeof(struct in_addr); ND_PRINT((ndo," len=%d %s/%u.%u.%u.%u", len, ipaddr_string(ndo, data), - mask[0], mask[1], mask[2], mask[3])); + EXTRACT_U_1(mask), EXTRACT_U_1(mask + 1), + EXTRACT_U_1(mask + 2), EXTRACT_U_1(mask + 3))); } len = 0; break; @@ -1443,10 +1444,10 @@ ikev1_id_print(netdissect_options *ndo, u_char tpay _U_, /*XXX*/ ND_PRINT((ndo," len=%d %s/0x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", len, ip6addr_string(ndo, data), - mask[0], mask[1], mask[2], mask[3], - mask[4], mask[5], mask[6], mask[7], - mask[8], mask[9], mask[10], mask[11], - mask[12], mask[13], mask[14], mask[15])); + EXTRACT_U_1(mask), EXTRACT_U_1(mask + 1), EXTRACT_U_1(mask + 2), EXTRACT_U_1(mask + 3), + EXTRACT_U_1(mask + 4), EXTRACT_U_1(mask + 5), EXTRACT_U_1(mask + 6), EXTRACT_U_1(mask + 7), + EXTRACT_U_1(mask + 8), EXTRACT_U_1(mask + 9), EXTRACT_U_1(mask + 10), EXTRACT_U_1(mask + 11), + EXTRACT_U_1(mask + 12), EXTRACT_U_1(mask + 13), EXTRACT_U_1(mask + 14), EXTRACT_U_1(mask + 15))); } len = 0; break; @@ -2603,7 +2604,7 @@ ikev2_vid_print(netdissect_options *ndo, u_char tpay, len = ntohs(e.len) - 4; ND_TCHECK2(*vid, len); for(i=0; i<len; i++) { - if(ND_ISPRINT(vid[i])) ND_PRINT((ndo, "%c", vid[i])); + if(ND_ISPRINT(vid[i])) ND_PRINT((ndo, "%c", EXTRACT_U_1(vid + i))); else ND_PRINT((ndo, ".")); } if (2 < ndo->ndo_vflag && 4 < len) { diff --git a/print-juniper.c b/print-juniper.c index f25b9f61..cb22c6c6 100644 --- a/print-juniper.c +++ b/print-juniper.c @@ -1362,7 +1362,7 @@ juniper_parse_header(netdissect_options *ndo, ND_PRINT((ndo, ", cookie 0x")); for (idx = 0; idx < l2info->cookie_len; idx++) { l2info->cookie[idx] = p[idx]; /* copy cookie data */ - if (ndo->ndo_eflag) ND_PRINT((ndo, "%02x", p[idx])); + if (ndo->ndo_eflag) ND_PRINT((ndo, "%02x", EXTRACT_U_1(p + idx))); } } diff --git a/print-l2tp.c b/print-l2tp.c index 7feab704..6cf0c0ad 100644 --- a/print-l2tp.c +++ b/print-l2tp.c @@ -396,7 +396,7 @@ l2tp_q931_cc_print(netdissect_options *ndo, const u_char *dat, u_int length) return; } print_16bits_val(ndo, (const uint16_t *)dat); - ND_PRINT((ndo, ", %02x", dat[2])); + ND_PRINT((ndo, ", %02x", EXTRACT_U_1(dat + 2))); dat += 3; length -= 3; if (length != 0) { diff --git a/print-llc.c b/print-llc.c index 289667c3..3673ef8d 100644 --- a/print-llc.c +++ b/print-llc.c @@ -378,7 +378,9 @@ llc_print(netdissect_options *ndo, const u_char *p, u_int length, u_int caplen, if (caplen > 0) ND_DEFAULTPRINT((const u_char *)p, caplen); } else - ND_PRINT((ndo, ": %02x %02x", p[1], p[2])); + ND_PRINT((ndo, ": %02x %02x", + EXTRACT_U_1(p + 1), + EXTRACT_U_1(p + 2))); return (hdrlen); } } diff --git a/print-lldp.c b/print-lldp.c index 6b34005f..1d829ac8 100644 --- a/print-lldp.c +++ b/print-lldp.c @@ -617,8 +617,10 @@ print_ets_priority_assignment_table(netdissect_options *ndo, ND_PRINT((ndo, "\n\t Priority Assignment Table")); ND_PRINT((ndo, "\n\t Priority : 0 1 2 3 4 5 6 7")); ND_PRINT((ndo, "\n\t Value : %-3d %-3d %-3d %-3d %-3d %-3d %-3d %-3d", - ptr[0]>>4,ptr[0]&0x0f,ptr[1]>>4,ptr[1]&0x0f,ptr[2]>>4, - ptr[2] & 0x0f, ptr[3] >> 4, ptr[3] & 0x0f)); + EXTRACT_U_1(ptr) >> 4, EXTRACT_U_1(ptr) & 0x0f, + EXTRACT_U_1(ptr + 1) >> 4, EXTRACT_U_1(ptr + 1) & 0x0f, + EXTRACT_U_1(ptr + 2) >> 4, EXTRACT_U_1(ptr + 2) & 0x0f, + EXTRACT_U_1(ptr + 3) >> 4, EXTRACT_U_1(ptr + 3) & 0x0f)); } static void @@ -628,7 +630,9 @@ print_tc_bandwidth_table(netdissect_options *ndo, ND_PRINT((ndo, "\n\t TC Bandwidth Table")); ND_PRINT((ndo, "\n\t TC%% : 0 1 2 3 4 5 6 7")); ND_PRINT((ndo, "\n\t Value : %-3d %-3d %-3d %-3d %-3d %-3d %-3d %-3d", - ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5], ptr[6], ptr[7])); + EXTRACT_U_1(ptr), EXTRACT_U_1(ptr + 1), EXTRACT_U_1(ptr + 2), + EXTRACT_U_1(ptr + 3), EXTRACT_U_1(ptr + 4), EXTRACT_U_1(ptr + 5), + EXTRACT_U_1(ptr + 6), EXTRACT_U_1(ptr + 7))); } static void @@ -638,7 +642,9 @@ print_tsa_assignment_table(netdissect_options *ndo, ND_PRINT((ndo, "\n\t TSA Assignment Table")); ND_PRINT((ndo, "\n\t Traffic Class: 0 1 2 3 4 5 6 7")); ND_PRINT((ndo, "\n\t Value : %-3d %-3d %-3d %-3d %-3d %-3d %-3d %-3d", - ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5], ptr[6], ptr[7])); + EXTRACT_U_1(ptr), EXTRACT_U_1(ptr + 1), EXTRACT_U_1(ptr + 2), + EXTRACT_U_1(ptr + 3), EXTRACT_U_1(ptr + 4), EXTRACT_U_1(ptr + 5), + EXTRACT_U_1(ptr + 6), EXTRACT_U_1(ptr + 7))); } /* diff --git a/print-mobility.c b/print-mobility.c index 3c0bd268..6d33ebd9 100644 --- a/print-mobility.c +++ b/print-mobility.c @@ -182,10 +182,10 @@ mobility_opt_print(netdissect_options *ndo, break; default: if (len - i < IP6MOPT_MINLEN) { - ND_PRINT((ndo, "(sopt_type %u: trunc)", bp[i])); + ND_PRINT((ndo, "(sopt_type %u: trunc)", EXTRACT_U_1(bp + i))); goto trunc; } - ND_PRINT((ndo, "(type-0x%02x: len=%u)", bp[i], bp[i + 1])); + ND_PRINT((ndo, "(type-0x%02x: len=%u)", EXTRACT_U_1(bp + i), EXTRACT_U_1(bp + i + 1))); break; } } diff --git a/print-pim.c b/print-pim.c index 4e1708f2..95b5b5c4 100644 --- a/print-pim.c +++ b/print-pim.c @@ -158,14 +158,14 @@ pimv1_join_prune_print(netdissect_options *ndo, unsigned_relts_print(ndo, hold); } ND_PRINT((ndo, "%s (%s/%d, %s", njoin ? "Join" : "Prune", - ipaddr_string(ndo, bp + 26), bp[25] & 0x3f, + ipaddr_string(ndo, bp + 26), EXTRACT_U_1(bp + 25) & 0x3f, ipaddr_string(ndo, bp + 12))); if (EXTRACT_BE_U_4(bp + 16) != 0xffffffff) ND_PRINT((ndo, "/%s", ipaddr_string(ndo, bp + 16))); ND_PRINT((ndo, ") %s%s %s", - (bp[24] & 0x01) ? "Sparse" : "Dense", - (bp[25] & 0x80) ? " WC" : "", - (bp[25] & 0x40) ? "RP" : "SPT")); + (EXTRACT_U_1(bp + 24) & 0x01) ? "Sparse" : "Dense", + (EXTRACT_U_1(bp + 25) & 0x80) ? " WC" : "", + (EXTRACT_U_1(bp + 25) & 0x40) ? "RP" : "SPT")); return; } @@ -232,11 +232,11 @@ pimv1_join_prune_print(netdissect_options *ndo, goto trunc; ND_TCHECK_6(bp); ND_PRINT((ndo, "\n\t%s %s%s%s%s/%d", type, - (bp[0] & 0x01) ? "Sparse " : "Dense ", - (bp[1] & 0x80) ? "WC " : "", - (bp[1] & 0x40) ? "RP " : "SPT ", + (EXTRACT_U_1(bp) & 0x01) ? "Sparse " : "Dense ", + (EXTRACT_U_1(bp + 1) & 0x80) ? "WC " : "", + (EXTRACT_U_1(bp + 1) & 0x40) ? "RP " : "SPT ", ipaddr_string(ndo, bp + 2), - bp[1] & 0x3f)); + EXTRACT_U_1(bp + 1) & 0x3f)); bp += 6; len -= 6; } @@ -271,7 +271,7 @@ pimv1_print(netdissect_options *ndo, ND_PRINT((ndo, " Sparse-Dense-mode")); break; default: - ND_PRINT((ndo, " mode-%d", bp[8] >> 4)); + ND_PRINT((ndo, " mode-%d", EXTRACT_U_1(bp + 8) >> 4)); break; } } @@ -311,9 +311,9 @@ pimv1_print(netdissect_options *ndo, ND_PRINT((ndo, "/%s", ipaddr_string(ndo, bp + 12))); ND_TCHECK_4(bp + 24); ND_PRINT((ndo, " %s pref %d metric %d", - (bp[20] & 0x80) ? "RP-tree" : "SPT", - EXTRACT_BE_U_4(bp + 20) & 0x7fffffff, - EXTRACT_BE_U_4(bp + 24))); + (EXTRACT_U_1(bp + 20) & 0x80) ? "RP-tree" : "SPT", + EXTRACT_BE_U_4(bp + 20) & 0x7fffffff, + EXTRACT_BE_U_4(bp + 24))); break; case PIMV1_TYPE_JOIN_PRUNE: case PIMV1_TYPE_GRAFT: @@ -327,7 +327,7 @@ pimv1_print(netdissect_options *ndo, } ND_TCHECK(bp[4]); if ((bp[4] >> 4) != 1) - ND_PRINT((ndo, " [v%d]", bp[4] >> 4)); + ND_PRINT((ndo, " [v%d]", EXTRACT_U_1(bp + 4) >> 4)); return; trunc: @@ -418,7 +418,7 @@ cisco_autorp_print(netdissect_options *ndo, break; } if (bp[0] & 0xfc) - ND_PRINT((ndo, " [rsvd=0x%02x]", bp[0] & 0xfc)); + ND_PRINT((ndo, " [rsvd=0x%02x]", EXTRACT_U_1(bp) & 0xfc)); bp += 1; len -= 1; if (len < 1) @@ -432,13 +432,13 @@ cisco_autorp_print(netdissect_options *ndo, if (len < 6) goto trunc; ND_TCHECK_6(bp); - ND_PRINT((ndo, "%c%s%s/%d", s, bp[0] & 1 ? "!" : "", - ipaddr_string(ndo, bp + 2), bp[1])); + ND_PRINT((ndo, "%c%s%s/%d", s, EXTRACT_U_1(bp) & 1 ? "!" : "", + ipaddr_string(ndo, bp + 2), EXTRACT_U_1(bp + 1))); if (bp[0] & 0x02) { ND_PRINT((ndo, " bidir")); } if (bp[0] & 0xfc) { - ND_PRINT((ndo, "[rsvd=0x%02x]", bp[0] & 0xfc)); + ND_PRINT((ndo, "[rsvd=0x%02x]", EXTRACT_U_1(bp) & 0xfc)); } s = ','; bp += 6; len -= 6; @@ -622,26 +622,26 @@ pimv2_addr_print(netdissect_options *ndo, if (!silent) { ND_PRINT((ndo, "%s", ipaddr_string(ndo, bp + 2))); if (bp[1] != 32) - ND_PRINT((ndo, "/%u", bp[1])); + ND_PRINT((ndo, "/%u", EXTRACT_U_1(bp + 1))); } } else if (af == AF_INET6) { if (!silent) { ND_PRINT((ndo, "%s", ip6addr_string(ndo, bp + 2))); if (bp[1] != 128) - ND_PRINT((ndo, "/%u", bp[1])); + ND_PRINT((ndo, "/%u", EXTRACT_U_1(bp + 1))); } } if (bp[0] && !silent) { if (at == pimv2_group) { - ND_PRINT((ndo, "(0x%02x)", bp[0])); + ND_PRINT((ndo, "(0x%02x)", EXTRACT_U_1(bp))); } else { ND_PRINT((ndo, "(%s%s%s", - bp[0] & 0x04 ? "S" : "", - bp[0] & 0x02 ? "W" : "", - bp[0] & 0x01 ? "R" : "")); + EXTRACT_U_1(bp) & 0x04 ? "S" : "", + EXTRACT_U_1(bp) & 0x02 ? "W" : "", + EXTRACT_U_1(bp) & 0x01 ? "R" : "")); if (bp[0] & 0xf8) { - ND_PRINT((ndo, "+0x%02x", bp[0] & 0xf8)); + ND_PRINT((ndo, "+0x%02x", EXTRACT_U_1(bp) & 0xf8)); } ND_PRINT((ndo, ")")); } @@ -1029,11 +1029,11 @@ pimv2_print(netdissect_options *ndo, if (len < 1) goto trunc; ND_TCHECK(bp[0]); - ND_PRINT((ndo, " hashmlen=%d", bp[0])); + ND_PRINT((ndo, " hashmlen=%d", EXTRACT_U_1(bp))); if (len < 2) goto trunc; ND_TCHECK(bp[2]); - ND_PRINT((ndo, " BSRprio=%d", bp[1])); + ND_PRINT((ndo, " BSRprio=%d", EXTRACT_U_1(bp + 1))); bp += 2; len -= 2; @@ -1056,11 +1056,11 @@ pimv2_print(netdissect_options *ndo, if (len < 1) goto trunc; ND_TCHECK(bp[0]); - ND_PRINT((ndo, " RPcnt=%d", bp[0])); + ND_PRINT((ndo, " RPcnt=%d", EXTRACT_U_1(bp))); if (len < 2) goto trunc; ND_TCHECK(bp[1]); - ND_PRINT((ndo, " FRPcnt=%d", frpcnt = bp[1])); + ND_PRINT((ndo, " FRPcnt=%d", frpcnt = EXTRACT_U_1(bp + 1))); if (len < 4) goto trunc; bp += 4; @@ -1086,7 +1086,7 @@ pimv2_print(netdissect_options *ndo, if (len < 3) goto trunc; ND_TCHECK(bp[2]); - ND_PRINT((ndo, ",prio=%d", bp[2])); + ND_PRINT((ndo, ",prio=%d", EXTRACT_U_1(bp + 2))); if (len < 4) goto trunc; bp += 4; @@ -1122,12 +1122,12 @@ pimv2_print(netdissect_options *ndo, if (len < 1) goto trunc; ND_TCHECK(bp[0]); - ND_PRINT((ndo, " prefix-cnt=%d", bp[0])); + ND_PRINT((ndo, " prefix-cnt=%d", EXTRACT_U_1(bp))); pfxcnt = bp[0]; if (len < 2) goto trunc; ND_TCHECK(bp[1]); - ND_PRINT((ndo, " prio=%d", bp[1])); + ND_PRINT((ndo, " prio=%d", EXTRACT_U_1(bp + 1))); if (len < 4) goto trunc; ND_TCHECK_2(bp + 2); diff --git a/print-radius.c b/print-radius.c index 403db1d3..d517e0c4 100644 --- a/print-radius.c +++ b/print-radius.c @@ -909,7 +909,7 @@ print_attr_netmask6(netdissect_options *ndo, ND_TCHECK2(data[0], length); if (data[1] > 128) { - ND_PRINT((ndo, "ERROR: netmask %u not in range (0..128)", data[1])); + ND_PRINT((ndo, "ERROR: netmask %u not in range (0..128)", EXTRACT_U_1(data + 1))); return; } @@ -917,7 +917,7 @@ print_attr_netmask6(netdissect_options *ndo, if (length > 2) memcpy(data2, data+2, length-2); - ND_PRINT((ndo, "%s/%u", ip6addr_string(ndo, data2), data[1])); + ND_PRINT((ndo, "%s/%u", ip6addr_string(ndo, data2), EXTRACT_U_1(data + 1))); if (data[1] > 8 * (length - 2)) ND_PRINT((ndo, " (inconsistent prefix length)")); @@ -151,8 +151,8 @@ sliplink_print(netdissect_options *ndo, register int i; for (i = SLX_CHDR; i < SLX_CHDR + CHDR_LEN - 1; ++i) - ND_PRINT((ndo, "%02x.", p[i])); - ND_PRINT((ndo, "%02x: ", p[SLX_CHDR + CHDR_LEN - 1])); + ND_PRINT((ndo, "%02x.", EXTRACT_U_1(p + i))); + ND_PRINT((ndo, "%02x: ", EXTRACT_U_1(p + SLX_CHDR + CHDR_LEN - 1))); return; } switch (p[SLX_CHDR] & 0xf0) { @@ -188,7 +188,7 @@ sliplink_print(netdissect_options *ndo, length, dir); ND_PRINT((ndo, ": ")); } else - ND_PRINT((ndo, "slip-%d!: ", p[SLX_CHDR])); + ND_PRINT((ndo, "slip-%d!: ", EXTRACT_U_1(p + SLX_CHDR))); } } diff --git a/print-smb.c b/print-smb.c index a9b6a4a0..3640b876 100644 --- a/print-smb.c +++ b/print-smb.c @@ -837,7 +837,8 @@ print_smb(netdissect_options *ndo, ND_PRINT((ndo, "NTError = %s\n", nt_errstr(nterror))); } else { if (buf[5]) - ND_PRINT((ndo, "SMBError = %s\n", smb_errstr(buf[5], EXTRACT_LE_U_2(buf + 7)))); + ND_PRINT((ndo, "SMBError = %s\n", smb_errstr(EXTRACT_U_1(buf + 5), + EXTRACT_LE_U_2(buf + 7)))); } smboffset = 32; diff --git a/print-stp.c b/print-stp.c index 79b297ad..66b6d0cd 100644 --- a/print-stp.c +++ b/print-stp.c @@ -304,7 +304,7 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, stp_print_bridge_id(ptr + MST_BPDU_CIST_BRIDGE_ID_OFFSET))); ND_TCHECK(ptr[MST_BPDU_CIST_REMAIN_HOPS_OFFSET]); - ND_PRINT((ndo, "CIST remaining-hops %d", ptr[MST_BPDU_CIST_REMAIN_HOPS_OFFSET])); + ND_PRINT((ndo, "CIST remaining-hops %d", EXTRACT_U_1(ptr + MST_BPDU_CIST_REMAIN_HOPS_OFFSET))); /* Dump all MSTI's */ ND_TCHECK_2(ptr + MST_BPDU_VER3_LEN_OFFSET); @@ -321,15 +321,15 @@ stp_print_mstp_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, ND_PRINT((ndo, "\n\tMSTI %d, Flags [%s], port-role %s", msti, bittok2str(stp_bpdu_flag_values, "none", EXTRACT_U_1(ptr + offset)), tok2str(rstp_obj_port_role_values, "Unknown", - RSTP_EXTRACT_PORT_ROLE(ptr[offset])))); + RSTP_EXTRACT_PORT_ROLE(EXTRACT_U_1(ptr + offset))))); ND_PRINT((ndo, "\n\t\tMSTI regional-root-id %s, pathcost %u", stp_print_bridge_id(ptr + offset + MST_BPDU_MSTI_ROOT_PRIO_OFFSET), EXTRACT_BE_U_4(ptr + offset + MST_BPDU_MSTI_ROOT_PATH_COST_OFFSET))); ND_PRINT((ndo, "\n\t\tMSTI bridge-prio %d, port-prio %d, hops %d", - ptr[offset + MST_BPDU_MSTI_BRIDGE_PRIO_OFFSET] >> 4, - ptr[offset + MST_BPDU_MSTI_PORT_PRIO_OFFSET] >> 4, - ptr[offset + MST_BPDU_MSTI_REMAIN_HOPS_OFFSET])); + EXTRACT_U_1(ptr + offset + MST_BPDU_MSTI_BRIDGE_PRIO_OFFSET) >> 4, + EXTRACT_U_1(ptr + offset + MST_BPDU_MSTI_PORT_PRIO_OFFSET) >> 4, + EXTRACT_U_1(ptr + offset + MST_BPDU_MSTI_REMAIN_HOPS_OFFSET))); len -= MST_BPDU_MSTI_LENGTH; offset += MST_BPDU_MSTI_LENGTH; @@ -373,14 +373,14 @@ stp_print_spb_bpdu(netdissect_options *ndo, const struct stp_bpdu_ *stp_bpdu, "flag %d,\n\tRestricted role-flag: %d, Format id %d cap %d, " "Convention id %d cap %d,\n\tEdge count %d, " "Agreement digest %08x%08x%08x%08x%08x\n", - ptr[offset + SPB_BPDU_AGREEMENT_OFFSET]>>6, - ptr[offset + SPB_BPDU_AGREEMENT_OFFSET]>>4 & 0x3, - ptr[offset + SPB_BPDU_AGREEMENT_OFFSET]>>3 & 0x1, - ptr[offset + SPB_BPDU_AGREEMENT_OFFSET]>>2 & 0x1, - ptr[offset + SPB_BPDU_AGREEMENT_FORMAT_OFFSET]>>4, - ptr[offset + SPB_BPDU_AGREEMENT_FORMAT_OFFSET]&0x00ff, - ptr[offset + SPB_BPDU_AGREEMENT_CON_OFFSET]>>4, - ptr[offset + SPB_BPDU_AGREEMENT_CON_OFFSET]&0x00ff, + EXTRACT_U_1(ptr + offset + SPB_BPDU_AGREEMENT_OFFSET)>>6, + EXTRACT_U_1(ptr + offset + SPB_BPDU_AGREEMENT_OFFSET)>>4 & 0x3, + EXTRACT_U_1(ptr + offset + SPB_BPDU_AGREEMENT_OFFSET)>>3 & 0x1, + EXTRACT_U_1(ptr + offset + SPB_BPDU_AGREEMENT_OFFSET)>>2 & 0x1, + EXTRACT_U_1(ptr + offset + SPB_BPDU_AGREEMENT_FORMAT_OFFSET)>>4, + EXTRACT_U_1(ptr + offset + SPB_BPDU_AGREEMENT_FORMAT_OFFSET)&0x00ff, + EXTRACT_U_1(ptr + offset + SPB_BPDU_AGREEMENT_CON_OFFSET)>>4, + EXTRACT_U_1(ptr + offset + SPB_BPDU_AGREEMENT_CON_OFFSET)&0x00ff, EXTRACT_BE_U_2(ptr + offset + SPB_BPDU_AGREEMENT_EDGE_OFFSET), EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET), EXTRACT_BE_U_4(ptr + offset + SPB_BPDU_AGREEMENT_DIGEST_OFFSET + 4), diff --git a/print-sunatm.c b/print-sunatm.c index 8c0b132a..eaa7125d 100644 --- a/print-sunatm.c +++ b/print-sunatm.c @@ -78,7 +78,7 @@ sunatm_if_print(netdissect_options *ndo, } if (ndo->ndo_eflag) { - ND_PRINT((ndo, p[DIR_POS] & 0x80 ? "Tx: " : "Rx: ")); + ND_PRINT((ndo, EXTRACT_U_1(p + DIR_POS) & 0x80 ? "Tx: " : "Rx: ")); } switch (p[DIR_POS] & 0x0f) { diff --git a/print-tcp.c b/print-tcp.c index 2fae1e2b..59e343ae 100644 --- a/print-tcp.c +++ b/print-tcp.c @@ -531,19 +531,19 @@ tcp_print(netdissect_options *ndo, case CANT_CHECK_SIGNATURE: ND_PRINT((ndo, "can't check - ")); for (i = 0; i < TCP_SIGLEN; ++i) - ND_PRINT((ndo, "%02x", cp[i])); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(cp + i))); break; } #else for (i = 0; i < TCP_SIGLEN; ++i) - ND_PRINT((ndo, "%02x", cp[i])); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(cp + i))); #endif break; case TCPOPT_SCPS: datalen = 2; LENCHECK(datalen); - ND_PRINT((ndo, " cap %02x id %u", cp[0], cp[1])); + ND_PRINT((ndo, " cap %02x id %u", EXTRACT_U_1(cp), EXTRACT_U_1(cp + 1))); break; case TCPOPT_TCPAO: @@ -557,14 +557,14 @@ tcp_print(netdissect_options *ndo, ND_PRINT((ndo, " invalid")); } else { LENCHECK(1); - ND_PRINT((ndo, " keyid %u", cp[0])); + ND_PRINT((ndo, " keyid %u", EXTRACT_U_1(cp))); LENCHECK(2); - ND_PRINT((ndo, " rnextkeyid %u", cp[1])); + ND_PRINT((ndo, " rnextkeyid %u", EXTRACT_U_1(cp + 1))); if (datalen > 2) { ND_PRINT((ndo, " mac 0x")); for (i = 2; i < datalen; i++) { LENCHECK(i + 1); - ND_PRINT((ndo, "%02x", cp[i])); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(cp + i))); } } } @@ -633,7 +633,7 @@ tcp_print(netdissect_options *ndo, ND_PRINT((ndo, " 0x")); for (i = 0; i < datalen; ++i) { LENCHECK(i + 1); - ND_PRINT((ndo, "%02x", cp[i])); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(cp + i))); } break; } @@ -829,7 +829,7 @@ print_tcp_fastopen_option(netdissect_options *ndo, register const u_char *cp, } else { ND_PRINT((ndo, " cookie ")); for (i = 0; i < datalen; ++i) - ND_PRINT((ndo, "%02x", cp[i])); + ND_PRINT((ndo, "%02x", EXTRACT_U_1(cp + i))); } } } diff --git a/print-vrrp.c b/print-vrrp.c index 73eef9a2..fe3104f9 100644 --- a/print-vrrp.c +++ b/print-vrrp.c @@ -120,13 +120,13 @@ vrrp_print(netdissect_options *ndo, if (version < 2 || version > 3 || type != VRRP_TYPE_ADVERTISEMENT) return; ND_TCHECK(bp[2]); - ND_PRINT((ndo, ", vrid %u, prio %u", bp[1], bp[2])); + ND_PRINT((ndo, ", vrid %u, prio %u", EXTRACT_U_1(bp + 1), EXTRACT_U_1(bp + 2))); ND_TCHECK(bp[5]); if (version == 2) { auth_type = bp[4]; ND_PRINT((ndo, ", authtype %s", tok2str(auth2str, NULL, auth_type))); - ND_PRINT((ndo, ", intvl %us, length %u", bp[5], len)); + ND_PRINT((ndo, ", intvl %us, length %u", EXTRACT_U_1(bp + 5), len)); } else { /* version == 3 */ uint16_t intvl = (bp[4] & 0x0f) << 8 | bp[5]; ND_PRINT((ndo, ", intvl %ucs, length %u", intvl, len)); |