]> git.sur5r.net Git - u-boot/commitdiff
Avoid dereferencing NULL in find_cmd() if no valid commands were found
authorWolfgang Denk <wd@pollux.denx.de>
Sun, 12 Mar 2006 01:20:55 +0000 (02:20 +0100)
committerWolfgang Denk <wd@pollux.denx.de>
Sun, 12 Mar 2006 01:20:55 +0000 (02:20 +0100)
Patch by Andrew Dyer, 13 Jun 2005

CHANGELOG
common/main.c

index 20e875aabf393edc2f54bac8c810c85934d4ad8c..2348df63c015a577093eb5a958b87302373eb4e9 100644 (file)
--- 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
index f042f3a636fd6171ce2f96c6f8a15b49fb33169b..445cb18491b0688eaad32a774583a5203ac1c21b 100644 (file)
@@ -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 */