summaryrefslogtreecommitdiff
path: root/print-lisp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2020-01-19 19:55:38 -0800
committerGuy Harris <guy@alum.mit.edu>2020-01-19 19:55:38 -0800
commit306c2a0384af923a73bf234f3c8bc186ceff0b58 (patch)
tree0598390b879d6e9a76ff3b906989a920222d2654 /print-lisp.c
parent2cd0a90c24ccf01ad9a034d7d5a6a651c82a4785 (diff)
downloadtcpdump-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-lisp.c')
-rw-r--r--print-lisp.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/print-lisp.c b/print-lisp.c
index 5c6825ae..ab8feca6 100644
--- a/print-lisp.c
+++ b/print-lisp.c
@@ -308,14 +308,16 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length)
switch (eid_afi) {
case IPv4_AFI:
ND_TCHECK_4(packet_iterator + packet_offset);
- ND_PRINT(" EID %s/%u,", ipaddr_string(ndo,
- packet_iterator + packet_offset), mask_len);
+ ND_PRINT(" EID %s/%u,",
+ GET_IPADDR_STRING(packet_iterator + packet_offset),
+ mask_len);
packet_offset += 4;
break;
case IPv6_AFI:
ND_TCHECK_16(packet_iterator + packet_offset);
- ND_PRINT(" EID %s/%u,", ip6addr_string(ndo,
- packet_iterator + packet_offset), mask_len);
+ ND_PRINT(" EID %s/%u,",
+ GET_IP6ADDR_STRING(packet_iterator + packet_offset),
+ mask_len);
packet_offset += 16;
break;
default:
@@ -342,12 +344,12 @@ lisp_print(netdissect_options *ndo, const u_char *bp, u_int length)
switch (loc_afi) {
case IPv4_AFI:
ND_TCHECK_4(packet_iterator + packet_offset);
- ND_PRINT(" LOC %s", ipaddr_string(ndo, loc_ip_pointer));
+ ND_PRINT(" LOC %s", GET_IPADDR_STRING(loc_ip_pointer));
packet_offset += 4;
break;
case IPv6_AFI:
ND_TCHECK_16(packet_iterator + packet_offset);
- ND_PRINT(" LOC %s", ip6addr_string(ndo, loc_ip_pointer));
+ ND_PRINT(" LOC %s", GET_IP6ADDR_STRING(loc_ip_pointer));
packet_offset += 16;
break;
default: