From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ppoornix@ecsmtp.ir.intel.com>
Received: from mga03.intel.com (mga03.intel.com [134.134.136.65])
 by dpdk.org (Postfix) with ESMTP id ADCE31B0F9;
 Mon,  4 Feb 2019 08:24:28 +0100 (CET)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from fmsmga005.fm.intel.com ([10.253.24.32])
 by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 03 Feb 2019 23:24:27 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.56,559,1539673200"; d="scan'208";a="317427830"
Received: from irvmail001.ir.intel.com ([163.33.26.43])
 by fmsmga005.fm.intel.com with ESMTP; 03 Feb 2019 23:24:26 -0800
Received: from wgcvswdev001.ir.intel.com (wgcvswdev001.ir.intel.com
 [10.102.246.100])
 by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id
 x147OPsx019895; Mon, 4 Feb 2019 07:24:25 GMT
Received: from wgcvswdev001.ir.intel.com (localhost [127.0.0.1])
 by wgcvswdev001.ir.intel.com with ESMTP id x147Nodh004629;
 Mon, 4 Feb 2019 07:23:50 GMT
Received: (from ppoornix@localhost)
	by wgcvswdev001.ir.intel.com with œ id x147NoMY004625;
	Mon, 4 Feb 2019 07:23:50 GMT
From: Pallantla Poornima <pallantlax.poornima@intel.com>
To: dev@dpdk.org
Cc: reshma.pattan@intel.com, jasvinder.singh@intel.com,
 cristian.dumitrescu@intel.com,
 Pallantla Poornima <pallantlax.poornima@intel.com>, stable@dpdk.org
Date: Mon,  4 Feb 2019 07:23:48 +0000
Message-Id: <1549265028-4493-1-git-send-email-pallantlax.poornima@intel.com>
X-Mailer: git-send-email 1.7.0.7
In-Reply-To: <y>
References: <y>
Subject: [dpdk-stable] [PATCH] net/softnic: fix sprintf with snprintf
X-BeenThere: stable@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches for DPDK stable branches <stable.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/stable>,
 <mailto:stable-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/stable/>
List-Post: <mailto:stable@dpdk.org>
List-Help: <mailto:stable-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/stable>,
 <mailto:stable-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 04 Feb 2019 07:24:29 -0000

sprintf function is not secure as it doesn't check the length of string.
More secure function snprintf is used.

Fixes: daabf2fb94 ("net/softnic: map flow action to table action")
Cc: stable@dpdk.org

Signed-off-by: Pallantla Poornima <pallantlax.poornima@intel.com>
---
 drivers/net/softnic/rte_eth_softnic_flow.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/softnic/rte_eth_softnic_flow.c b/drivers/net/softnic/rte_eth_softnic_flow.c
index 21e753001..aefc384dc 100644
--- a/drivers/net/softnic/rte_eth_softnic_flow.c
+++ b/drivers/net/softnic/rte_eth_softnic_flow.c
@@ -1283,7 +1283,8 @@ flow_rule_action_get(struct pmd_internals *softnic,
 					action,
 					"QUEUE: Invalid RX queue ID");
 
-			sprintf(name, "RXQ%u", (uint32_t)conf->index);
+			snprintf(name, sizeof(name), "RXQ%u",
+					(uint32_t)conf->index);
 
 			status = softnic_pipeline_port_out_find(softnic,
 				pipeline->name,
@@ -1373,7 +1374,7 @@ flow_rule_action_get(struct pmd_internals *softnic,
 						action,
 						"RSS: Invalid RX queue ID");
 
-				sprintf(name, "RXQ%u",
+				snprintf(name, sizeof(name), "RXQ%u",
 					(uint32_t)conf->queue[i]);
 
 				status = softnic_pipeline_port_out_find(softnic,
-- 
2.17.2