Cannot dereference pointer for token[1] unless valid.

Fixes: 5074e1d551 ("examples/pipeline: add configuration commands")
Cc: [email protected]

Signed-off-by: Cristian Dumitrescu <[email protected]>
---
 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 3f490854c..cacfb2823 100644
--- a/examples/pipeline/cli.c
+++ b/examples/pipeline/cli.c
@@ -1420,7 +1420,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.17.1

Reply via email to