aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device
diff options
context:
space:
mode:
authorBenoît Ganne <bganne@cisco.com>2020-07-16 12:03:35 +0200
committerDamjan Marion <dmarion@me.com>2020-07-16 21:41:12 +0000
commit1bd6f61820c6c15534ebb04a4b070ba84bf08a9d (patch)
tree5cc63818ce49ae6cd0b886f20f0edebdf56a2eb6 /src/plugins/dpdk/device
parent65b65a4692c84462ecf500806795ea0350073e18 (diff)
vppinfra: fix format_c_identifier vector overflow
In case of vector, we must check length before trying to access element. Also fix wrong DPDK plugin workaround. Type: fix Change-Id: I2ecef1c88ebef2362f48cab0d462699aa43cd4b9 Signed-off-by: Benoît Ganne <bganne@cisco.com>
Diffstat (limited to 'src/plugins/dpdk/device')
-rw-r--r--src/plugins/dpdk/device/format.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c
index dad15052b45..19476cb19dd 100644
--- a/src/plugins/dpdk/device/format.c
+++ b/src/plugins/dpdk/device/format.c
@@ -710,12 +710,10 @@ format_dpdk_device (u8 * s, va_list * args)
xstat = vec_elt_at_index(xd->xstats, i);
if (verbose == 2 || (verbose && xstat->value))
{
- /* format_c_identifier doesn't like c strings inside vector */
- u8 * name = format(0,"%s", xstat_names[i].name);
xs = format(xs, "\n%U%-38U%16Lu",
format_white_space, indent + 4,
- format_c_identifier, name, xstat->value);
- vec_free(name);
+ format_c_identifier, xstat_names[i].name,
+ xstat->value);
}
}
/* *INDENT-ON* */