Skip to content
Snippets Groups Projects
Commit e4fdcadd authored by Lucian Cojocar's avatar Lucian Cojocar Committed by Tom Rini
Browse files

env: throw an error when an empty key is used


If the environment contains an entry like "=value" "\0" we should throw
an error when parsing the environment. Otherwise, U-Boot will enter in
an infinite loop.

Signed-off-by: default avatarLucian Cojocar <cojocar@gmail.com>
parent d642c467
No related branches found
No related tags found
No related merge requests found
...@@ -901,6 +901,12 @@ int himport_r(struct hsearch_data *htab, ...@@ -901,6 +901,12 @@ int himport_r(struct hsearch_data *htab,
*sp++ = '\0'; /* terminate value */ *sp++ = '\0'; /* terminate value */
++dp; ++dp;
if (*name == 0) {
debug("INSERT: unable to use an empty key\n");
__set_errno(EINVAL);
return 0;
}
/* Skip variables which are not supposed to be processed */ /* Skip variables which are not supposed to be processed */
if (!drop_var_from_set(name, nvars, localvars)) if (!drop_var_from_set(name, nvars, localvars))
continue; continue;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment