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 <[email protected]>
Signed-off-by: Andrew Rybchenko <[email protected]>
---
lib/librte_eal/common/eal_common_devargs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_eal/common/eal_common_devargs.c
b/lib/librte_eal/common/eal_common_devargs.c
index a22a2002e..5ec688aab 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);
--
2.17.1