DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] app/testpmd: fix copying the name of the dynflag
@ 2020-01-30 13:22 Ori Kam
  2020-01-30 16:54 ` Iremonger, Bernard
                   ` (3 more replies)
  0 siblings, 4 replies; 15+ messages in thread
From: Ori Kam @ 2020-01-30 13:22 UTC (permalink / raw)
  To: Wenzhuo Lu, Jingjing Wu, Bernard Iremonger
  Cc: dev, orika, ferruh.yigit, viacheslavo

When working with testpmd and setting the dynflag name, we copy the
name given by the cmd to the dynflag name.

The issue is that the size of the dynflag name is smaller then the
string used by testpmd.

This commit solves this issue by usign strncpy.

Coverity issue: 353610

Fixes: b57b66a97ebf ("app/testpmd: support mbuf dynamic flag")

Signed-off-by: Ori Kam <orika@mellanox.com>
---
 app/test-pmd/cmdline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index dab22bc..09429f9 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -18867,7 +18867,7 @@ struct cmd_config_tx_dynf_specific_result {
 		return;
 	flag = rte_mbuf_dynflag_lookup(res->name, NULL);
 	if (flag <= 0) {
-		strcpy(desc_flag.name, res->name);
+		strncpy(desc_flag.name, res->name, sizeof(*desc_flag.name));
 		desc_flag.flags = 0;
 		flag = rte_mbuf_dynflag_register(&desc_flag);
 		if (flag < 0) {
-- 
1.8.3.1


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

end of thread, other threads:[~2020-02-04 17:58 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-30 13:22 [dpdk-dev] [PATCH] app/testpmd: fix copying the name of the dynflag Ori Kam
2020-01-30 16:54 ` Iremonger, Bernard
2020-01-30 18:55   ` Ori Kam
2020-01-30 19:09     ` Ori Kam
2020-01-30 20:55 ` [dpdk-dev] [PATCH v2] " Ori Kam
2020-01-30 21:04 ` [dpdk-dev] [PATCH v3] " Ori Kam
2020-01-31 14:02   ` Ferruh Yigit
2020-02-02  9:12     ` Ori Kam
2020-02-04 10:45       ` Iremonger, Bernard
2020-02-04 11:12         ` Ori Kam
2020-02-04 12:18           ` Iremonger, Bernard
2020-02-04 13:03             ` Ori Kam
2020-02-04 13:39 ` [dpdk-dev] [PATCH v4] " Ori Kam
2020-02-04 14:39   ` Iremonger, Bernard
2020-02-04 17:58     ` 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).