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 --- tools/env/fw_env.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tools') diff --git a/tools/env/fw_env.c b/tools/env/fw_env.c index 2c607bf49..520ce3fd8 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++ == '=') -- cgit v1.2.3