summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/cmd_nvedit.c3
-rw-r--r--tools/env/fw_env.c2
2 files changed, 5 insertions, 0 deletions
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index d655ab9684e..1f9c6742602 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -650,6 +650,9 @@ U_BOOT_CMD(
*/
int envmatch(uchar *s1, int i2)
{
+ if (s1 == NULL)
+ return -1;
+
while (*s1 == env_get_char(i2++))
if (*s1++ == '=')
return i2;
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 2c607bf4916..520ce3fd898 100644
--- a/tools/env/fw_env.c
+++ b/tools/env/fw_env.c
@@ -1057,6 +1057,8 @@ exit:
static char *envmatch (char * s1, char * s2)
{
+ if (s1 == NULL || s2 == NULL)
+ return NULL;
while (*s1 == *s2++)
if (*s1++ == '=')