summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWolfgang Denk <wd@pollux.denx.de>2006-03-12 02:20:55 +0100
committerWolfgang Denk <wd@pollux.denx.de>2006-03-12 02:20:55 +0100
commit1264b4050c6f635cc237b5821f924817457ce50c (patch)
treeda63ef53f8f1b1c823fef6f4c595400bc12ede84
parent6cb142fa3b732a2cea257ca39ef4a7dbe81a32e1 (diff)
downloadu-boot-imx-1264b4050c6f635cc237b5821f924817457ce50c.zip
u-boot-imx-1264b4050c6f635cc237b5821f924817457ce50c.tar.gz
u-boot-imx-1264b4050c6f635cc237b5821f924817457ce50c.tar.bz2
Avoid dereferencing NULL in find_cmd() if no valid commands were found
Patch by Andrew Dyer, 13 Jun 2005
-rw-r--r--CHANGELOG3
-rw-r--r--common/main.c9
2 files changed, 9 insertions, 3 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 20e875a..2348df6 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,9 @@
Changes since U-Boot 1.1.4:
======================================================================
+* Avoid dereferencing NULL in find_cmd() if no valid commands were found
+ Patch by Andrew Dyer, 13 Jun 2005
+
* Add ADI Blackfin support
- add support for Analog Devices Blackfin BF533 CPU
- add support for the ADI BF533 Stamp uClinux board
diff --git a/common/main.c b/common/main.c
index f042f3a..445cb18 100644
--- a/common/main.c
+++ b/common/main.c
@@ -919,7 +919,10 @@ int run_command (const char *cmd, int flag)
process_macros (token, finaltoken);
/* Extract arguments */
- argc = parse_line (finaltoken, argv);
+ if ((argc = parse_line (finaltoken, argv)) == 0) {
+ rc = -1; /* no command at all */
+ continue;
+ }
/* Look up command in command table */
if ((cmdtp = find_cmd(argv[0])) == NULL) {
@@ -945,9 +948,9 @@ int run_command (const char *cmd, int flag)
puts ("'bootd' recursion detected\n");
rc = -1;
continue;
- }
- else
+ } else {
flag |= CMD_FLAG_BOOTD;
+ }
}
#endif /* CFG_CMD_BOOTD */