From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.warmcat.com (mail.warmcat.com [163.172.24.82]) by dpdk.org (Postfix) with ESMTP id 910024C76 for ; Tue, 8 May 2018 06:45:30 +0200 (CEST) From: Andy Green To: dev@dpdk.org Date: Tue, 08 May 2018 12:29:53 +0800 Message-ID: <152575379320.56689.8382051384798098704.stgit@localhost.localdomain> In-Reply-To: <152575364588.56689.3300796065057551728.stgit@localhost.localdomain> References: <152575364588.56689.3300796065057551728.stgit@localhost.localdomain> User-Agent: StGit/unknown-version Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] [PATCH 05/18] drivers: net: nfp: nfpcore: fix strncpy misuse 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: Tue, 08 May 2018 04:45:30 -0000 --- drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c index 4e6c66624..9f6704a7f 100644 --- a/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c +++ b/drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c @@ -846,7 +846,8 @@ nfp6000_init(struct nfp_cpp *cpp, const char *devname) memset(desc->busdev, 0, BUSDEV_SZ); - strncpy(desc->busdev, devname, strlen(devname)); + strncpy(desc->busdev, devname, sizeof(desc->busdev) - 1); + desc->busdev[sizeof(desc->busdev) - 1] = '\0'; ret = nfp_acquire_process_lock(desc); if (ret)