From 821848f5192c6b6be954fa9f04c0e6a470cff2b6 Mon Sep 17 00:00:00 2001 From: Cristian Dumitrescu Date: Thu, 28 Jan 2021 19:12:39 +0000 Subject: [PATCH] examples/pipeline: fix CLI parsing crash Cannot dereference pointer for token[1] unless valid. Fixes: 5074e1d551 ("examples/pipeline: add configuration commands") Cc: stable@dpdk.org Signed-off-by: Cristian Dumitrescu --- examples/pipeline/cli.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/pipeline/cli.c b/examples/pipeline/cli.c index d0150cfcf6..e97e120606 100644 --- a/examples/pipeline/cli.c +++ b/examples/pipeline/cli.c @@ -1294,7 +1294,7 @@ cli_process(char *in, char *out, size_t out_size, void *obj) } if (strcmp(tokens[0], "link") == 0) { - if (strcmp(tokens[1], "show") == 0) { + if ((n_tokens >= 2) && (strcmp(tokens[1], "show") == 0)) { cmd_link_show(tokens, n_tokens, out, out_size, obj); return; } -- 2.20.1