[3/4] net/softnic: fix string copy

Message ID 1540909372-23110-3-git-send-email-reshma.pattan@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series [1/4] net/softnic: fix string copy |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Pattan, Reshma Oct. 30, 2018, 2:22 p.m. UTC
  From: Reshma Pattan <reshma.pattan@intel.com>

Use strlcpy instead of strcpy to avoid buffer overrun.

Coverity issue: 323475

Fixes: c169b6a588 ("net/softnic: map flow attribute to pipeline table")
CC: cristian.dumitrescu@intel.com
CC: jasvinder.singh@intel.com

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
---
 drivers/net/softnic/rte_eth_softnic_flow.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/softnic/rte_eth_softnic_flow.c b/drivers/net/softnic/rte_eth_softnic_flow.c
index 285af462b..295bc6c83 100644
--- a/drivers/net/softnic/rte_eth_softnic_flow.c
+++ b/drivers/net/softnic/rte_eth_softnic_flow.c
@@ -56,7 +56,7 @@  flow_attr_map_set(struct pmd_internals *softnic,
 
 	map = (ingress) ? &softnic->flow.ingress_map[group_id] :
 		&softnic->flow.egress_map[group_id];
-	strcpy(map->pipeline_name, pipeline_name);
+	strlcpy(map->pipeline_name, pipeline_name, sizeof(map->pipeline_name));
 	map->table_id = table_id;
 	map->valid = 1;