summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/init.c
diff options
context:
space:
mode:
authorElias Rudberg <elias.rudberg@bahnhof.net>2019-09-12 14:57:47 +0200
committerDave Wallace <dwallacelf@gmail.com>2019-09-12 14:21:22 +0000
commit7fd402163c221919446942c0784073a56bfd4f70 (patch)
tree5239fa8c69d342307aef9f4febf80d952934a5cf /src/plugins/dpdk/device/init.c
parent58519563acc0933771172941291b7d0de2ffeddc (diff)
dpdk: fix null-termination of strings
Fix problem with some strings not being null-terminated, by using the vec_terminate_c_string macro in two places. The problem was found using AddressSanitizer. (Also make sure indentation is OK for those changes.) Ticket: VPP-1772 Type: fix Signed-off-by: Elias Rudberg <elias.rudberg@bahnhof.net> Change-Id: Ib7826e3c322e58b649e2d7f6053786da618a5e9e
Diffstat (limited to 'src/plugins/dpdk/device/init.c')
-rw-r--r--src/plugins/dpdk/device/init.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index a2651823806..ff0dfc760dc 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -1388,6 +1388,7 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
vec_insert (conf->eal_init_args, 2, 3);
conf->eal_init_args[3] = (u8 *) "-n";
tmp = format (0, "%d", conf->nchannels);
+ vec_terminate_c_string (tmp);
conf->eal_init_args[4] = tmp;
}
@@ -1481,6 +1482,8 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input)
conf->eal_init_args_str = format (conf->eal_init_args_str, "%s ",
conf->eal_init_args[i]);
+ vec_terminate_c_string (conf->eal_init_args_str);
+
dpdk_log_warn ("EAL init args: %s", conf->eal_init_args_str);
ret = rte_eal_init (vec_len (conf->eal_init_args),
(char **) conf->eal_init_args);