From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 3ECBEC6DC for ; Fri, 24 Jun 2016 15:55:01 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 24 Jun 2016 06:55:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.26,521,1459839600"; d="scan'208";a="994374167" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 24 Jun 2016 06:54:59 -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 u5ODswNX003316; Fri, 24 Jun 2016 14:54:58 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id u5ODswZA031186; Fri, 24 Jun 2016 14:54:58 +0100 Received: (from reshmapa@localhost) by sivswdev02.ir.intel.com with id u5ODsw4h031182; Fri, 24 Jun 2016 14:54:58 +0100 From: Reshma Pattan To: dev@dpdk.org Cc: Reshma Pattan Date: Fri, 24 Jun 2016 14:54:32 +0100 Message-Id: <1466776473-30883-5-git-send-email-reshma.pattan@intel.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1466776473-30883-1-git-send-email-reshma.pattan@intel.com> References: <1466692599-26716-1-git-send-email-reshma.pattan@intel.com> <1466776473-30883-1-git-send-email-reshma.pattan@intel.com> Subject: [dpdk-dev] [PATCH v4 4/5] 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: Fri, 24 Jun 2016 13:55:01 -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