From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 16F65C2D0DB for ; Thu, 30 Jan 2020 20:55:39 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id C41952083E for ; Thu, 30 Jan 2020 20:55:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C41952083E Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=mellanox.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A56611C02D; Thu, 30 Jan 2020 21:55:37 +0100 (CET) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id 72BB11C02C for ; Thu, 30 Jan 2020 21:55:35 +0100 (CET) Received: from Internal Mail-Server by MTLPINE2 (envelope-from orika@mellanox.com) with ESMTPS (AES256-SHA encrypted); 30 Jan 2020 22:55:30 +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 00UKtUw4012406; Thu, 30 Jan 2020 22:55:30 +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 20:55:08 +0000 Message-Id: <1580417708-4583-1-git-send-email-orika@mellanox.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1580390564-186435-1-git-send-email-orika@mellanox.com> References: <1580390564-186435-1-git-send-email-orika@mellanox.com> Subject: [dpdk-dev] [PATCH v2] 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 checking if the requested name is too long. Coverity issue: 353610 Fixes: b57b66a97ebf ("app/testpmd: support mbuf dynamic flag") Signed-off-by: Ori Kam --- V2: * Move len check to start of function. --- app/test-pmd/cmdline.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index dab22bc..de5ef41 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -18865,6 +18865,10 @@ struct cmd_config_tx_dynf_specific_result { if (port_id_is_invalid(res->port_id, ENABLED_WARN)) return; + if (strlen(res->name) > sizeof(desc_flag.name)) { + printf("Flag name too long\n"); + return; + } flag = rte_mbuf_dynflag_lookup(res->name, NULL); if (flag <= 0) { strcpy(desc_flag.name, res->name); -- 1.8.3.1