summaryrefslogtreecommitdiffstats
path: root/src/vnet/ip/ip6_neighbor.c
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2019-07-10 15:40:33 +0200
committerDave Barach <openvpp@barachs.net>2019-07-10 19:07:53 +0000
commitadbaf7bc2e301e591d63fae47f0a9bbb1577494e (patch)
tree2103281466594b7954982966b208995c6a05f1b3 /src/vnet/ip/ip6_neighbor.c
parent6a3a4f7340bdc687814d7905ef1e4ca1a3b02d57 (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/ip6_neighbor.c')
-rw-r--r--src/vnet/ip/ip6_neighbor.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/src/vnet/ip/ip6_neighbor.c b/src/vnet/ip/ip6_neighbor.c
index c332b2c1bc9..071d3eb6673 100644
--- a/src/vnet/ip/ip6_neighbor.c
+++ b/src/vnet/ip/ip6_neighbor.c
@@ -342,31 +342,19 @@ format_ip6_neighbor_ip6_entry (u8 * s, va_list * va)
ip6_neighbor_t *n = va_arg (*va, ip6_neighbor_t *);
vnet_main_t *vnm = vnet_get_main ();
vnet_sw_interface_t *si;
- u8 *flags = 0;
if (!n)
return format (s, "%=12s%=45s%=6s%=20s%=40s", "Time", "Address", "Flags",
"Link layer", "Interface");
- if (n->flags & IP_NEIGHBOR_FLAG_DYNAMIC)
- flags = format (flags, "D");
-
- if (n->flags & IP_NEIGHBOR_FLAG_STATIC)
- flags = format (flags, "S");
-
- if (n->flags & IP_NEIGHBOR_FLAG_NO_FIB_ENTRY)
- flags = format (flags, "N");
-
si = vnet_get_sw_interface (vnm, n->key.sw_if_index);
- s = format (s, "%=12U%=45U%=6s%=20U%=40U",
- format_vlib_time, vm, n->time_last_updated,
- format_ip6_address, &n->key.ip6_address,
- flags ? (char *) flags : "",
- format_mac_address_t, &n->mac,
- format_vnet_sw_interface_name, vnm, si);
-
- vec_free (flags);
- return s;
+
+ return format (s, "%=12U%=45U%=6U%=20U%=40U",
+ format_vlib_time, vm, n->time_last_updated,
+ format_ip6_address, &n->key.ip6_address,
+ format_ip_neighbor_flags, n->flags,
+ format_mac_address_t, &n->mac,
+ format_vnet_sw_interface_name, vnm, si);
}
static void