From 38b63a30ca0d8bc5aeea5e683be7b69a6a19a2dd Mon Sep 17 00:00:00 2001 From: Matthew Smith Date: Thu, 14 Jan 2021 16:51:57 -0600 Subject: dpdk: terminate device devargs string Type: fix When a device is whitelisted with devargs arguments specified, the string that is generated and added to conf->eal_init_args is not explicitly terminated with 0. If the formatted string takes up all of the memory allocated to the vector which stores it and it is used later as a string in a format() or printf() call, any nonzero characters stored in memory at the address immediately following the memory allocated for the vector will be erroneously appended to the string. Terminate the string with 0 to ensure that this does not happen. Change-Id: I20a78d994daad93bf5aecab5c03d705022e882ec Signed-off-by: Matthew Smith --- src/plugins/dpdk/device/init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins/dpdk/device') diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c index f3d228c5820..a1eead20541 100644 --- a/src/plugins/dpdk/device/init.c +++ b/src/plugins/dpdk/device/init.c @@ -1595,7 +1595,8 @@ dpdk_config (vlib_main_t * vm, unformat_input_t * input) vec_add1 (conf->eal_init_args, tmp); if (devconf->devargs) { - tmp = format (0, "%U,%s", format_vlib_pci_addr, &devconf->pci_addr, devconf->devargs, 0); + tmp = format (0, "%U,%s%c", format_vlib_pci_addr, + &devconf->pci_addr, devconf->devargs, 0); } else { -- cgit 1.2.3-korg