summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-parser.c5
-rw-r--r--cli/src/registry.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 8ea6581af..92626df76 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -320,6 +320,11 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options
/* reset the count value now */
count = 1;
+ if (index >= wordcount) {
+ ret = -1;
+ goto out;
+ }
+
brick_index = index;
ret = cli_cmd_bricks_parse (words, wordcount, brick_index, &bricks,
diff --git a/cli/src/registry.c b/cli/src/registry.c
index 3bdc8929a..5b63e82b1 100644
--- a/cli/src/registry.c
+++ b/cli/src/registry.c
@@ -268,7 +268,7 @@ cli_getunamb (const char *tok, void **choices, cli_selector_t sel)
unsigned mn = 0;
void *ret = NULL;
- if (!choices || !*tok)
+ if (!choices || !tok || !*tok)
return NULL;
for (wcon = choices; *wcon; wcon++) {