summaryrefslogtreecommitdiff
path: root/common/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/command.c')
-rw-r--r--common/command.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/common/command.c b/common/command.c
index 50c84292c1..f51df26bf9 100644
--- a/common/command.c
+++ b/common/command.c
@@ -40,8 +40,15 @@ int _do_help (cmd_tbl_t *cmd_start, int cmd_items, cmd_tbl_t * cmdtp, int
int i;
int rcode = 0;
+ if (cmd_items > CONFIG_SYS_MAXARGS) {
+ printf("%s: cmd_items %d exceeds hardcoded limit %d."
+ " Recompile with higher CONFIG_SYS_MAXARGS?\n",
+ __func__, cmd_items, CONFIG_SYS_MAXARGS);
+ return -1;
+ }
+
if (argc == 1) { /*show list of commands */
- cmd_tbl_t *cmd_array[cmd_items];
+ cmd_tbl_t *cmd_array[CONFIG_SYS_MAXARGS];
int i, j, swaps;
/* Make array of commands from .uboot_cmd section */