[dpdk-stable] [PATCH] examples/pipeline: fix CLI segfault

Cristian Dumitrescu cristian.dumitrescu at intel.com
Thu Jan 28 20:12:39 CET 2021


Cannot dereference pointer for token[1] unless valid.

Fixes: 5074e1d551 ("examples/pipeline: add configuration commands")
Cc: stable at dpdk.org

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu at intel.com>
---
 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



More information about the stable mailing list