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 D9FC949E2 for ; Tue, 8 May 2018 07:15:30 +0200 (CEST) From: Andy Green To: dev@dpdk.org Date: Tue, 08 May 2018 12:30:28 +0800 Message-ID: <152575382842.56689.4589071928538784307.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 12/18] drivers: net: sfc: fix another strncpy size and NUL 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 05:15:31 -0000 --- drivers/net/sfc/sfc_ethdev.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/sfc/sfc_ethdev.c b/drivers/net/sfc/sfc_ethdev.c index e9bb283e0..bd5f17f33 100644 --- a/drivers/net/sfc/sfc_ethdev.c +++ b/drivers/net/sfc/sfc_ethdev.c @@ -662,10 +662,13 @@ sfc_xstats_get_names(struct rte_eth_dev *dev, for (i = 0; i < EFX_MAC_NSTATS; ++i) { if (EFX_MAC_STAT_SUPPORTED(port->mac_stats_mask, i)) { - if (xstats_names != NULL && nstats < xstats_count) + if (xstats_names != NULL && nstats < xstats_count) { strncpy(xstats_names[nstats].name, efx_mac_stat_name(sa->nic, i), - sizeof(xstats_names[0].name)); + sizeof(xstats_names[0].name) - 1); + xstats_names[0].name[ + sizeof(xstats_names[0].name) - 1] = '\0'; + } nstats++; } }