diff mbox series

[v2] app/testpmd: fix copying the name of the dynflag

Message ID 1580417708-4583-1-git-send-email-orika@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers show
Series [v2] app/testpmd: fix copying the name of the dynflag | expand


Context Check Description
ci/Intel-compilation fail apply issues
ci/travis-robot success Travis build: passed
ci/checkpatch warning coding style issues

Commit Message

Ori Kam Jan. 30, 2020, 8:55 p.m. UTC
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 checking if the requested name
is too long.

Coverity issue: 353610

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

Signed-off-by: Ori Kam <orika@mellanox.com>
 * Move len check to start of function.
 app/test-pmd/cmdline.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series


diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index dab22bc..de5ef41 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -18865,6 +18865,10 @@  struct cmd_config_tx_dynf_specific_result {
 	if (port_id_is_invalid(res->port_id, ENABLED_WARN))
+	if (strlen(res->name) > sizeof(desc_flag.name)) {
+		printf("Flag name too long\n");
+		return;
+	}	
 	flag = rte_mbuf_dynflag_lookup(res->name, NULL);
 	if (flag <= 0) {
 		strcpy(desc_flag.name, res->name);