summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk
diff options
context:
space:
mode:
authorElias Rudberg <elias.rudberg@bahnhof.net>2019-09-12 14:57:47 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-09-30 15:23:24 +0000
commit8e356191694e08463e3acaed1c39277c983d845e (patch)
treebee7663821586161dcf49f18c1b042937e62794f /src/plugins/dpdk
parent003dd32489d768a8fc227da8b7218bc11126a592 (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 (cherry picked from commit 7fd402163c221919446942c0784073a56bfd4f70)
Diffstat (limited to 'src/plugins/dpdk')
-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 86419f7bcc5..6f3178fcf21 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);