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 3244C1B814 for ; Thu, 10 May 2018 04:47:13 +0200 (CEST) From: Andy Green To: dev@dpdk.org Date: Thu, 10 May 2018 10:47:09 +0800 Message-ID: <152592042949.119328.18149908188196720417.stgit@localhost.localdomain> In-Reply-To: <152591991920.119328.14523975619615362920.stgit@localhost.localdomain> References: <152591991920.119328.14523975619615362920.stgit@localhost.localdomain> User-Agent: StGit/unknown-version Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] [PATCH v3 10/40] drivers/net/sfc: fix strncpy length 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: Thu, 10 May 2018 02:47:13 -0000 Signed-off-by: Andy Green --- drivers/net/sfc/sfc_ethdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index e42d55350..ef5e9ecb2 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "efx.h" @@ -741,9 +742,8 @@ sfc_xstats_get_names_by_id(struct rte_eth_dev *dev, if ((ids == NULL) || (ids[nb_written] == nb_supported)) { char *name = xstats_names[nb_written++].name; - strncpy(name, efx_mac_stat_name(sa->nic, i), + strlcpy(name, efx_mac_stat_name(sa->nic, i), sizeof(xstats_names[0].name)); - name[sizeof(xstats_names[0].name) - 1] = '\0'; } ++nb_supported;