Commit 7ac80551 authored by Gerlando Falauto's avatar Gerlando Falauto Committed by Tom Rini

env: fix crash using default -f -a

env default -a -f calls env_check_apply on all existing environment
variables with a NULL value for "newval" as a way of cleaning up.
This causes string manipulation functions to crash on most architectures.
So replace a NULL argument with an empty string.
Reported-By: default avatarStefano Babic <sbabic@denx.de>
Signed-off-by: default avatarGerlando Falauto <gerlando.falauto@keymile.com>
Tested-by: default avatarStefano Babic <sbabic@denx.de>
parent 961c437b
......@@ -215,6 +215,9 @@ int env_check_apply(const char *name, const char *oldval,
{
int console = -1;
/* Default value for NULL to protect string-manipulating functions */
newval = newval ? : "";
/* Check for console redirection */
if (strcmp(name, "stdin") == 0)
console = stdin;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment