From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dispatch1-us1.ppe-hosted.com (dispatch1-us1.ppe-hosted.com [148.163.129.52]) by dpdk.org (Postfix) with ESMTP id D8F06160 for ; Wed, 18 Jul 2018 09:23:37 +0200 (CEST) X-Virus-Scanned: Proofpoint Essentials engine Received: from webmail.solarflare.com (webmail.solarflare.com [12.187.104.26]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1-us3.ppe-hosted.com (Proofpoint Essentials ESMTP Server) with ESMTPS id 6D535B40057; Wed, 18 Jul 2018 07:23:36 +0000 (UTC) Received: from ocex03.SolarFlarecom.com (10.20.40.36) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25; Wed, 18 Jul 2018 00:23:33 -0700 Received: from opal.uk.solarflarecom.com (10.17.10.1) by ocex03.SolarFlarecom.com (10.20.40.36) with Microsoft SMTP Server (TLS) id 15.0.1044.25 via Frontend Transport; Wed, 18 Jul 2018 00:23:33 -0700 Received: from ukv-loginhost.uk.solarflarecom.com (ukv-loginhost.uk.solarflarecom.com [10.17.10.39]) by opal.uk.solarflarecom.com (8.13.8/8.13.8) with ESMTP id w6I7NW6c023430; Wed, 18 Jul 2018 08:23:32 +0100 Received: from ukv-loginhost.uk.solarflarecom.com (localhost [127.0.0.1]) by ukv-loginhost.uk.solarflarecom.com (Postfix) with ESMTP id 3F2221657BF; Wed, 18 Jul 2018 08:23:32 +0100 (BST) From: Andrew Rybchenko To: CC: Gaetan Rivet Date: Wed, 18 Jul 2018 08:23:30 +0100 Message-ID: <1531898610-19654-1-git-send-email-arybchenko@solarflare.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-MDID: 1531898617-JFgk9sqdBRSm Subject: [dpdk-dev] [PATCH] devargs: fix devargs truncation when format string is used X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jul 2018 07:23:38 -0000 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 --- 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