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

Message ID 1540909372-23110-2-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>

Replace strcpy with strlcpy to avoid buffer overrun.

Coverity issue: 323515

Fixes: b767f8efc8 ("net/softnic: replace pointers with arrays")
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_cli.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/softnic/rte_eth_softnic_cli.c b/drivers/net/softnic/rte_eth_softnic_cli.c
index 2235b07e8..a0beca904 100644
--- a/drivers/net/softnic/rte_eth_softnic_cli.c
+++ b/drivers/net/softnic/rte_eth_softnic_cli.c
@@ -2485,7 +2485,8 @@  cmd_pipeline_table(struct pmd_internals *softnic,
 			return;
 		}
 
-		strcpy(p.action_profile_name, tokens[t0 + 1]);
+		strlcpy(p.action_profile_name, tokens[t0 + 1],
+			sizeof(p.action_profile_name));
 
 		t0 += 2;
 	}