[PATCH 3/4] app/testpmd: check for no arguments
Kevin Traynor
ktraynor at redhat.com
Thu Mar 12 11:36:05 CET 2026
For the case where token is NULL, there are no arguments
and split_str[0] is used uninitialized.
Check counter to ensure there is a token and return error if not.
Fixes: 601576ae6699 ("app/testpmd: add prio-tc map in DCB command")
Cc: stable at dpdk.org
Signed-off-by: Kevin Traynor <ktraynor at redhat.com>
---
app/test-pmd/cmdline.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index c33c66f327..ab85f4e0ad 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -3570,4 +3570,9 @@ parse_dcb_token_value(char *token_str,
} while (1);
+ if (split_num == 0) {
+ fprintf(stderr, "Bad Argument: no arguments provided\n");
+ return -1;
+ }
+
/* parse fixed parameter "pfc-en" first. */
token = split_str[0];
--
2.53.0
More information about the dev
mailing list