From: Cristian Dumitrescu Date: Thu, 28 Jan 2021 19:12:39 +0000 (+0000) Subject: examples/pipeline: fix CLI parsing crash X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=821848f5192c6b6be954fa9f04c0e6a470cff2b6;p=dpdk.git 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 --- 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; }