From 870f45338872b5ac02b2f87b6409036a6292ecf3 Mon Sep 17 00:00:00 2001 From: Ahmad Fatoum Date: Thu, 26 Nov 2020 19:31:53 +0100 Subject: commands: nv: pass empty string for nv Setting a variable via the nv command results in the call chain nvar_add() -> nv_save() -> __nv_save(). __nv_save isn't supposed to be called with val=NULL argument however: dprintf(fd, "%s", val); Avoid this from happening by translating NULL into the empty string. This aligns nv with the behavior of hush and setenv (but not global, this will need to be looked at separately). Signed-off-by: Ahmad Fatoum Signed-off-by: Sascha Hauer --- commands/nv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/commands/nv.c b/commands/nv.c index fa865811dc..a1cff08ee4 100644 --- a/commands/nv.c +++ b/commands/nv.c @@ -59,6 +59,8 @@ static int do_nv(int argc, char *argv[]) if (value) { *value = 0; value++; + } else { + value = ""; } if (do_remove) { -- cgit v1.2.3