diff options
author | Benoît Ganne <bganne@cisco.com> | 2019-07-10 15:40:33 +0200 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2019-07-10 19:07:53 +0000 |
commit | adbaf7bc2e301e591d63fae47f0a9bbb1577494e (patch) | |
tree | 2103281466594b7954982966b208995c6a05f1b3 /src/vnet/ip/ip_neighbor.c | |
parent | 6a3a4f7340bdc687814d7905ef1e4ca1a3b02d57 (diff) |
ip: fix show ip neigh vector read overflow
Both format_ethernet_arp_ip4_entry() and format_ip6_neighbor_ip6_entry()
used %s to format flags which is a vector and not a null-terminated
C-string.
Introduce format_ip_neighbor_flags() instead.
Type: fix
Fixes: 102ec52bc4
Change-Id: I0c9349fefbeb76471933de358acceb50512a21aa
Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/vnet/ip/ip_neighbor.c')
-rw-r--r-- | src/vnet/ip/ip_neighbor.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/vnet/ip/ip_neighbor.c b/src/vnet/ip/ip_neighbor.c index ad89d3ff679..bd0144101ed 100644 --- a/src/vnet/ip/ip_neighbor.c +++ b/src/vnet/ip/ip_neighbor.c @@ -47,6 +47,23 @@ typedef struct static ip_neighbor_scan_config_t ip_neighbor_scan_conf; +u8 * +format_ip_neighbor_flags (u8 * s, va_list * args) +{ + const ip_neighbor_flags_t flags = va_arg (*args, int); + + if (flags & IP_NEIGHBOR_FLAG_STATIC) + s = format (s, "S"); + + if (flags & IP_NEIGHBOR_FLAG_DYNAMIC) + s = format (s, "D"); + + if (flags & IP_NEIGHBOR_FLAG_NO_FIB_ENTRY) + s = format (s, "N"); + + return s; +} + int ip_neighbor_add (const ip46_address_t * ip, ip46_type_t type, |