mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
Common/command: Guard strchr/strlen from NULL pointer
Guard strchr/strlen from being called with NULL pointer. This line is crashing when command "env" is called without subcommand. The cmd is NULL in this case because the calling function "do_env" decremented the argc without checking if there are still arguments available. Signed-off-by: Thomas Weber <weber@corscience.de>
This commit is contained in:
parent
5904da0214
commit
7013c06124
1 changed files with 2 additions and 0 deletions
|
@ -108,6 +108,8 @@ cmd_tbl_t *find_cmd_tbl (const char *cmd, cmd_tbl_t *table, int table_len)
|
|||
int len;
|
||||
int n_found = 0;
|
||||
|
||||
if (!cmd)
|
||||
return NULL;
|
||||
/*
|
||||
* Some commands allow length modifiers (like "cp.b");
|
||||
* compare command name only until first dot.
|
||||
|
|
Loading…
Reference in a new issue