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: [email protected]

Signed-off-by: Kevin Traynor <[email protected]>
---
 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

Reply via email to