diff options
author | Guy Harris <guy@alum.mit.edu> | 2020-01-19 19:55:38 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2020-01-19 19:55:38 -0800 |
commit | 306c2a0384af923a73bf234f3c8bc186ceff0b58 (patch) | |
tree | 0598390b879d6e9a76ff3b906989a920222d2654 /print-eigrp.c | |
parent | 2cd0a90c24ccf01ad9a034d7d5a6a651c82a4785 (diff) | |
download | tcpdump-306c2a0384af923a73bf234f3c8bc186ceff0b58.tar.gz |
More bounds checking when fetching addresses and converting to strings.
Replace more calls to ipaddr_string()/ip6addr_string() with calls to
GET_IPADDR_STRING()/GET_IP6ADDR_STRING() macros performing bounds
checking.
Add similar bounds-checking inline functions and macros to wrap
linkaddr_string(), etheraddr_string(), and isonsap_string() and convert
calls to them to use the macros as well.
Shuffle the inline functions in addrtoname.h around a bit, so that the
inline functions, external declarations, and macros are all in the same
order.
Diffstat (limited to 'print-eigrp.c')
-rw-r--r-- | print-eigrp.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/print-eigrp.c b/print-eigrp.c index 37570979..029d2458 100644 --- a/print-eigrp.c +++ b/print-eigrp.c @@ -360,13 +360,13 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) GET_CPY_BYTES(prefix, tlv_ptr.eigrp_tlv_ip_int->destination, byte_length); ND_PRINT("\n\t IPv4 prefix: %15s/%u, nexthop: ", - ipaddr_string(ndo, prefix), + ipaddr_string(ndo, prefix), /* local buffer, not packet data; don't use GET_IPADDR_STRING() */ bit_length); if (GET_BE_U_4(tlv_ptr.eigrp_tlv_ip_int->nexthop) == 0) ND_PRINT("self"); else ND_PRINT("%s", - ipaddr_string(ndo, tlv_ptr.eigrp_tlv_ip_int->nexthop)); + GET_IPADDR_STRING(tlv_ptr.eigrp_tlv_ip_int->nexthop)); ND_PRINT("\n\t delay %u ms, bandwidth %u Kbps, mtu %u, hop %u, reliability %u, load %u", (GET_BE_U_4(tlv_ptr.eigrp_tlv_ip_int->delay)/100), @@ -395,16 +395,16 @@ eigrp_print(netdissect_options *ndo, const u_char *pptr, u_int len) GET_CPY_BYTES(prefix, tlv_ptr.eigrp_tlv_ip_ext->destination, byte_length); ND_PRINT("\n\t IPv4 prefix: %15s/%u, nexthop: ", - ipaddr_string(ndo, prefix), + ipaddr_string(ndo, prefix), /* local buffer, not packet data; don't use GET_IPADDR_STRING() */ bit_length); if (GET_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->nexthop) == 0) ND_PRINT("self"); else ND_PRINT("%s", - ipaddr_string(ndo, tlv_ptr.eigrp_tlv_ip_ext->nexthop)); + GET_IPADDR_STRING(tlv_ptr.eigrp_tlv_ip_ext->nexthop)); ND_PRINT("\n\t origin-router %s, origin-as %u, origin-proto %s, flags [0x%02x], tag 0x%08x, metric %u", - ipaddr_string(ndo, tlv_ptr.eigrp_tlv_ip_ext->origin_router), + GET_IPADDR_STRING(tlv_ptr.eigrp_tlv_ip_ext->origin_router), GET_BE_U_4(tlv_ptr.eigrp_tlv_ip_ext->origin_as), tok2str(eigrp_ext_proto_id_values,"unknown",GET_U_1(tlv_ptr.eigrp_tlv_ip_ext->proto_id)), GET_U_1(tlv_ptr.eigrp_tlv_ip_ext->flags), |