* [dpdk-dev] [PATCH] devargs: fix devargs truncation when format string is used
@ 2018-07-18 7:23 Andrew Rybchenko
2018-07-18 8:42 ` Gaëtan Rivet
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Rybchenko @ 2018-07-18 7:23 UTC (permalink / raw)
To: dev; +Cc: Gaetan Rivet
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 <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
---
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] devargs: fix devargs truncation when format string is used
2018-07-18 7:23 [dpdk-dev] [PATCH] devargs: fix devargs truncation when format string is used Andrew Rybchenko
@ 2018-07-18 8:42 ` Gaëtan Rivet
2018-07-20 9:18 ` Thomas Monjalon
0 siblings, 1 reply; 3+ messages in thread
From: Gaëtan Rivet @ 2018-07-18 8:42 UTC (permalink / raw)
To: Andrew Rybchenko; +Cc: dev
Hi,
On Wed, Jul 18, 2018 at 08:23:30AM +0100, Andrew Rybchenko wrote:
> 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 <ivan.malov@oktetlabs.ru>
> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
> ---
> 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);
Indeed, thanks for reporting and fixing.
> va_end(ap);
>
> return rte_devargs_parse(da, dev);
> --
> 2.17.1
>
--
Gaëtan Rivet
6WIND
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] devargs: fix devargs truncation when format string is used
2018-07-18 8:42 ` Gaëtan Rivet
@ 2018-07-20 9:18 ` Thomas Monjalon
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2018-07-20 9:18 UTC (permalink / raw)
To: Andrew Rybchenko; +Cc: dev, Gaëtan Rivet
18/07/2018 10:42, Gaëtan Rivet:
> Hi,
>
> On Wed, Jul 18, 2018 at 08:23:30AM +0100, Andrew Rybchenko wrote:
> > 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 <ivan.malov@oktetlabs.ru>
> > Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Applied, thanks
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-07-20 9:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-18 7:23 [dpdk-dev] [PATCH] devargs: fix devargs truncation when format string is used Andrew Rybchenko
2018-07-18 8:42 ` Gaëtan Rivet
2018-07-20 9:18 ` Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).