[dpdk-dev] [PATCH 2/4] net/softnic: fix string copy

Reshma Pattan reshma.pattan at intel.com
Tue Oct 30 15:22:50 CET 2018


From: Reshma Pattan <reshma.pattan at intel.com>

Replace strcpy with strlcpy to avoid buffer overrun.

Coverity issue: 323515

Fixes: b767f8efc8 ("net/softnic: replace pointers with arrays")
CC: cristian.dumitrescu at intel.com
CC: jasvinder.singh at intel.com

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

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;
 	}
-- 
2.17.1



More information about the dev mailing list