From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 9BE16C562 for ; Thu, 23 Jun 2016 16:36:57 +0200 (CEST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP; 23 Jun 2016 07:36:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,517,1459839600"; d="scan'208";a="981902506" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by orsmga001.jf.intel.com with ESMTP; 23 Jun 2016 07:36:42 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id u5NEaf4j016335; Thu, 23 Jun 2016 15:36:41 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u5NEaf33026787; Thu, 23 Jun 2016 15:36:41 +0100 Received: (from reshmapa@localhost) by sivswdev02.ir.intel.com with id u5NEafWb026783; Thu, 23 Jun 2016 15:36:41 +0100 From: Reshma Pattan To: dev@dpdk.org Cc: Reshma Pattan Date: Thu, 23 Jun 2016 15:36:39 +0100 Message-Id: <1466692599-26716-5-git-send-email-reshma.pattan@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1466692599-26716-1-git-send-email-reshma.pattan@intel.com> References: <1466604475-11864-1-git-send-email-reshma.pattan@intel.com> <1466692599-26716-1-git-send-email-reshma.pattan@intel.com> Subject: [dpdk-dev] [PATCH v3 4/4] app/pdump: fix string overflow X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Jun 2016 14:36:58 -0000 replaced strncpy with snprintf for safely copying the strings. Coverity issue 127351: string overflow Fixes: caa7028276b8 ("app/pdump: add tool for packet capturing") Signed-off-by: Reshma Pattan --- app/pdump/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/pdump/main.c b/app/pdump/main.c index f8923b9..fe4d38a 100644 --- a/app/pdump/main.c +++ b/app/pdump/main.c @@ -217,12 +217,12 @@ parse_rxtxdev(const char *key, const char *value, void *extra_args) struct pdump_tuples *pt = extra_args; if (!strcmp(key, PDUMP_RX_DEV_ARG)) { - strncpy(pt->rx_dev, value, strlen(value)); + snprintf(pt->rx_dev, sizeof(pt->rx_dev), "%s", value); /* identify the tx stream type for pcap vdev */ if (if_nametoindex(pt->rx_dev)) pt->rx_vdev_stream_type = IFACE; } else if (!strcmp(key, PDUMP_TX_DEV_ARG)) { - strncpy(pt->tx_dev, value, strlen(value)); + snprintf(pt->tx_dev, sizeof(pt->tx_dev), "%s", value); /* identify the tx stream type for pcap vdev */ if (if_nametoindex(pt->tx_dev)) pt->tx_vdev_stream_type = IFACE; -- 2.5.0