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 934ADA0524; Thu, 30 Jan 2020 14:22:58 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 82B8B1BFFC; Thu, 30 Jan 2020 14:22:57 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 1C66B1BFFA for ; Thu, 30 Jan 2020 14:22:56 +0100 (CET) Received: from Internal Mail-Server by MTLPINE2 (envelope-from orika@mellanox.com) with ESMTPS (AES256-SHA encrypted); 30 Jan 2020 15:22:55 +0200 Received: from pegasus03.mtr.labs.mlnx (pegasus03.mtr.labs.mlnx [10.210.16.124]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id 00UDMs8v010245; Thu, 30 Jan 2020 15:22:55 +0200 From: Ori Kam To: Wenzhuo Lu , Jingjing Wu , Bernard Iremonger Cc: dev@dpdk.org, orika@mellanox.com, ferruh.yigit@intel.com, viacheslavo@mellanox.com Date: Thu, 30 Jan 2020 13:22:44 +0000 Message-Id: <1580390564-186435-1-git-send-email-orika@mellanox.com> X-Mailer: git-send-email 1.8.3.1 Subject: [dpdk-dev] [PATCH] app/testpmd: fix copying the name of the dynflag 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" When working with testpmd and setting the dynflag name, we copy the name given by the cmd to the dynflag name. The issue is that the size of the dynflag name is smaller then the string used by testpmd. This commit solves this issue by usign strncpy. Coverity issue: 353610 Fixes: b57b66a97ebf ("app/testpmd: support mbuf dynamic flag") Signed-off-by: Ori Kam --- app/test-pmd/cmdline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index dab22bc..09429f9 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -18867,7 +18867,7 @@ struct cmd_config_tx_dynf_specific_result { return; flag = rte_mbuf_dynflag_lookup(res->name, NULL); if (flag <= 0) { - strcpy(desc_flag.name, res->name); + strncpy(desc_flag.name, res->name, sizeof(*desc_flag.name)); desc_flag.flags = 0; flag = rte_mbuf_dynflag_register(&desc_flag); if (flag < 0) { -- 1.8.3.1