From 306c2a0384af923a73bf234f3c8bc186ceff0b58 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sun, 19 Jan 2020 19:55:38 -0800 Subject: 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. --- print-mobility.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'print-mobility.c') diff --git a/print-mobility.c b/print-mobility.c index 329f84a8..cdb43167 100644 --- a/print-mobility.c +++ b/print-mobility.c @@ -159,7 +159,7 @@ mobility_opt_print(netdissect_options *ndo, goto trunc; } ND_TCHECK_16(bp + i + 2); - ND_PRINT("(alt-CoA: %s)", ip6addr_string(ndo, bp + i + 2)); + ND_PRINT("(alt-CoA: %s)", GET_IP6ADDR_STRING(bp + i + 2)); break; case IP6MOPT_NONCEID: if (len - i < IP6MOPT_NONCEID_MINLEN) { @@ -326,7 +326,7 @@ mobility_print(netdissect_options *ndo, /* Reserved */ hlen = IP6M_MINLEN; ND_TCHECK_16(bp + hlen); - ND_PRINT(" homeaddr %s", ip6addr_string(ndo, bp + hlen)); + ND_PRINT(" homeaddr %s", GET_IP6ADDR_STRING(bp + hlen)); hlen += 16; break; default: -- cgit v1.2.1