DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/softnic: fix sprintf with snprintf
@ 2019-02-04  7:23 Pallantla Poornima
  2019-03-01 15:51 ` Ferruh Yigit
  0 siblings, 1 reply; 2+ messages in thread
From: Pallantla Poornima @ 2019-02-04  7:23 UTC (permalink / raw)
  To: dev
  Cc: reshma.pattan, jasvinder.singh, cristian.dumitrescu,
	Pallantla Poornima, stable

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] net/softnic: fix sprintf with snprintf
  2019-02-04  7:23 [dpdk-dev] [PATCH] net/softnic: fix sprintf with snprintf Pallantla Poornima
@ 2019-03-01 15:51 ` Ferruh Yigit
  0 siblings, 0 replies; 2+ messages in thread
From: Ferruh Yigit @ 2019-03-01 15:51 UTC (permalink / raw)
  To: Pallantla Poornima, dev
  Cc: reshma.pattan, jasvinder.singh, cristian.dumitrescu, stable

On 2/4/2019 7:23 AM, Pallantla Poornima wrote:
> 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>

Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>

Applied to dpdk-next-net/master, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-01 15:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-04  7:23 [dpdk-dev] [PATCH] net/softnic: fix sprintf with snprintf Pallantla Poornima
2019-03-01 15:51 ` Ferruh Yigit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).