From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5A7C3A04BA; Wed, 7 Oct 2020 11:27:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3B5ED1B3DF; Wed, 7 Oct 2020 11:27:35 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id 6D47D2B8C for ; Wed, 7 Oct 2020 11:27:33 +0200 (CEST) IronPort-SDR: adgLcIViS7cq0E8OM/K0Dc0BEr4fv+Nv+sULua2N57hsZwCGPPqgMNCdAF4RqPjX6eHP9q2xWr eFsYg86o7EhQ== X-IronPort-AV: E=McAfee;i="6000,8403,9766"; a="152643059" X-IronPort-AV: E=Sophos;i="5.77,346,1596524400"; d="scan'208";a="152643059" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2020 02:27:31 -0700 IronPort-SDR: I8vj4bhXp/Z0Nj/IuIlaHjNF4gDQ0QpTKWOEuJEheuTIjlXoqZqItCFPE9tvTGBUxaocrdYqPR 62aCVwkM8B8g== X-IronPort-AV: E=Sophos;i="5.77,346,1596524400"; d="scan'208";a="461246376" Received: from silpixa00399839.ir.intel.com (HELO localhost.localdomain) ([10.237.222.142]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2020 02:27:30 -0700 From: Ciara Loftus To: dev@dpdk.org Cc: Ciara Loftus Date: Wed, 7 Oct 2020 09:01:37 +0000 Message-Id: <20201007090137.5121-1-ciara.loftus@intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/af_xdp: use snprintf instead of strncpy 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" strncpy may leave the destination buffer not NULL terminated so use snprintf instead. Coverity issue: 362975 Fixes: 339b88c6a91f ("net/af_xdp: support multi-queue") Signed-off-by: Ciara Loftus --- drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index eaf2c9c873..52495cb8fb 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -1362,7 +1362,7 @@ xdp_get_channels_info(const char *if_name, int *max_queues, channels.cmd = ETHTOOL_GCHANNELS; ifr.ifr_data = (void *)&channels; - strncpy(ifr.ifr_name, if_name, IFNAMSIZ); + snprintf(ifr.ifr_name, IFNAMSIZ, "%s", if_name); ret = ioctl(fd, SIOCETHTOOL, &ifr); if (ret) { if (errno == EOPNOTSUPP) { -- 2.17.1