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: a23bc2c4e0 ("devargs: add non-variadic parsing function")

Reported-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
This commit is contained in:
Andrew Rybchenko 2018-07-18 08:23:30 +01:00 committed by Thomas Monjalon
parent e4ea1bbd6e
commit 7513bd68ae

View File

@ -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);