summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorFerruh Yigit <ferruh.yigit@intel.com>2018-11-02 19:06:06 +0000
committerThomas Monjalon <thomas@monjalon.net>2018-11-04 22:48:04 +0100
commit3370975b994d793a89812031d86534916067dd67 (patch)
tree4693f4c1be6463ae0a37420529f7246ff4330b9f /lib
parent74f277101265ff3376c65270da2dcbc6d1325494 (diff)
downloaddpdk-3370975b994d793a89812031d86534916067dd67.zip
dpdk-3370975b994d793a89812031d86534916067dd67.tar.gz
dpdk-3370975b994d793a89812031d86534916067dd67.tar.xz
eal: fix build with gcc 9.0
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: f9a08f650211 ("eal: add support for shared object drivers") Cc: stable@dpdk.org Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/librte_eal/common/eal_common_options.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index b82f3dd..e31eca5 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);