]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
env: Don't match empty variable name in env_match()
authorMarek Behún <marek.behun@nic.cz>
Sun, 17 Oct 2021 15:36:33 +0000 (17:36 +0200)
committerSimon Glass <sjg@chromium.org>
Thu, 21 Oct 2021 18:50:48 +0000 (12:50 -0600)
Do we really allow zero-length variable name? I guess not.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Simon Glass <sjg@chromium.org>
cmd/nvedit.c

index 5b1d4c244860c1ddb38bf324595be83144ed44e2..8d53579d92e73529d5ac3e29d3b4b55c597ba244 100644 (file)
@@ -708,7 +708,7 @@ char *from_env(const char *envvar)
 
 static const char *env_match(const char *p, const char *s1)
 {
-       if (s1 == NULL)
+       if (s1 == NULL || *s1 == '\0')
                return NULL;
 
        while (*s1 == *p++)