summaryrefslogtreecommitdiff
path: root/tools/env
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2012-10-03 09:38:50 +0000
committerTom Rini <trini@ti.com>2012-10-15 11:54:05 -0700
commit586197dfe42ffda777205b02fe404107eb7d974a (patch)
treef7f06afcf49dac5dec0f5d33e4be48d3ab8e768a /tools/env
parente4a223f04de2e271682f26d7b981c0012f6a459f (diff)
downloadu-boot-586197dfe42ffda777205b02fe404107eb7d974a.tar.gz
u-boot-586197dfe42ffda777205b02fe404107eb7d974a.tar.bz2
u-boot-586197dfe42ffda777205b02fe404107eb7d974a.zip
env: Check for NULL pointer in envmatch()
If the pointer passed into envmatch() is NULL, return -1 instead of crashing. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'tools/env')
-rw-r--r--tools/env/fw_env.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c
index 2c607bf491..520ce3fd89 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++ == '=')