From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet Subject: Re: [PATCH] devargs: fix devargs truncation when format string is used Date: Wed, 18 Jul 2018 10:42:22 +0200 Message-ID: <20180718084221.kbryl4ej5rmdioom@bidouze.vm.6wind.com> References: <1531898610-19654-1-git-send-email-arybchenko@solarflare.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Cc: dev@dpdk.org To: Andrew Rybchenko Return-path: Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by dpdk.org (Postfix) with ESMTP id CC0111DB8 for ; Wed, 18 Jul 2018 10:42:39 +0200 (CEST) Received: by mail-wm0-f68.google.com with SMTP id 69-v6so1950440wmf.3 for ; Wed, 18 Jul 2018 01:42:39 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1531898610-19654-1-git-send-email-arybchenko@solarflare.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "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 > Signed-off-by: Andrew Rybchenko Acked-by: Gaetan Rivet > --- > 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