From 586197dfe42ffda777205b02fe404107eb7d974a Mon Sep 17 00:00:00 2001 From: Joe Hershberger Date: Wed, 3 Oct 2012 09:38:50 +0000 Subject: 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 --- common/cmd_nvedit.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'common/cmd_nvedit.c') diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c index d655ab9684..1f9c674260 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; -- cgit v1.2.1