examples/pipeline: fix CLI segfault
Checks
Commit Message
Cannot dereference pointer for token[1] unless valid.
Fixes: 5074e1d551 ("examples/pipeline: add configuration commands")
Cc: stable@dpdk.org
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
examples/pipeline/cli.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
28/01/2021 20:12, Cristian Dumitrescu:
> Cannot dereference pointer for token[1] unless valid.
>
> Fixes: 5074e1d551 ("examples/pipeline: add configuration commands")
> Cc: stable@dpdk.org
>
> Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Applied, thanks
@@ -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;
}