DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: dev@dpdk.org, Ferruh Yigit <ferruh.yigit@intel.com>, stable@dpdk.org
Subject: [dpdk-dev] [PATCH v2 2/2] eal: fix build with gcc 9.0
Date: Fri,  2 Nov 2018 19:06:06 +0000	[thread overview]
Message-ID: <20181102190606.48279-2-ferruh.yigit@intel.com> (raw)
In-Reply-To: <20181102190606.48279-1-ferruh.yigit@intel.com>

build error:
In function ‘eal_plugin_add’,
    .../lib/librte_eal/common/eal_common_options.c:225:2:
    error: ‘strncpy’ output may be truncated copying 4095 bytes from a
           string of length 4095 [-Werror=stringop-truncation]
    strncpy(solib->name, path, PATH_MAX-1);

strncpy may result a not null-terminated string,
replaced it with strlcpy

Fixes: fa9cdc6f8410 ("eal: move plugin loading from linuxapp to common")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
v2:
* s/rte_strscpy/strlcpy/
---
 lib/librte_eal/common/eal_common_options.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index b82f3ddd1..e31eca5c0 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -222,7 +222,7 @@ eal_plugin_add(const char *path)
 		return -1;
 	}
 	memset(solib, 0, sizeof(*solib));
-	strncpy(solib->name, path, PATH_MAX-1);
+	strlcpy(solib->name, path, PATH_MAX-1);
 	solib->name[PATH_MAX-1] = 0;
 	TAILQ_INSERT_TAIL(&solib_list, solib, next);
 
-- 
2.17.2

  reply	other threads:[~2018-11-02 18:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-01 13:19 [dpdk-dev] [PATCH 1/2] bus/dpaa: " Ferruh Yigit
2018-11-01 12:49 ` Shreyansh Jain
2018-11-01 13:19 ` [dpdk-dev] [PATCH 2/2] eal: " Ferruh Yigit
2018-11-01 17:42 ` [dpdk-dev] [PATCH 1/2] bus/dpaa: " Stephen Hemminger
2018-11-01 17:45   ` Bruce Richardson
2018-11-01 18:21     ` Ferruh Yigit
2018-11-01 19:45       ` Thomas Monjalon
2018-11-02 19:06 ` [dpdk-dev] [PATCH v2 " Ferruh Yigit
2018-11-02 19:06   ` Ferruh Yigit [this message]
2018-11-04 21:38     ` [dpdk-dev] [dpdk-stable] [PATCH v2 2/2] eal: " Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181102190606.48279-2-ferruh.yigit@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=dev@dpdk.org \
    --cc=stable@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).