From: Andrew Rybchenko Date: Wed, 18 Jul 2018 07:23:30 +0000 (+0100) Subject: devargs: fix parsing truncation when using format X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=7513bd68ae525c58c19068645e714c9c9232eec7;p=dpdk.git devargs: fix parsing truncation when using format Space for string terminating NUL character should be provided to snprintf() to avoid the last symbol truncation. Fixes: a23bc2c4e01b ("devargs: add non-variadic parsing function") Reported-by: Ivan Malov Signed-off-by: Andrew Rybchenko Acked-by: Gaetan Rivet --- diff --git a/lib/librte_eal/common/eal_common_devargs.c b/lib/librte_eal/common/eal_common_devargs.c index 1a7b00ece8..dac2402a44 100644 --- a/lib/librte_eal/common/eal_common_devargs.c +++ b/lib/librte_eal/common/eal_common_devargs.c @@ -285,7 +285,7 @@ rte_devargs_parsef(struct rte_devargs *da, const char *format, ...) } va_start(ap, format); - vsnprintf(dev, len, format, ap); + vsnprintf(dev, len + 1, format, ap); va_end(ap); return rte_devargs_parse(da, dev);