[PATCH] bg_setenv: Avoid dereferencing uninitialized var in error path

1 view
Skip to first unread message

Jan Kiszka

unread,
Jun 30, 2020, 5:56:53 AM6/30/20
to efibootguard-dev
From: Jan Kiszka <jan.k...@siemens.com>

Found by coverity: If bgenv_open_latest() fails, env_new was still
uninitialized.

Fixes: 1a38da3fbab3 ("Establish proper lifecycle management for bgenv API")
Signed-off-by: Jan Kiszka <jan.k...@siemens.com>
---
tools/bg_setenv.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bg_setenv.c b/tools/bg_setenv.c
index 24b4067..05fb355 100644
--- a/tools/bg_setenv.c
+++ b/tools/bg_setenv.c
@@ -622,7 +622,7 @@ int main(int argc, char **argv)
return 0;
}

- BGENV *env_new;
+ BGENV *env_new = NULL;
BGENV *env_current;

if (auto_update) {
--
2.26.2
Reply all
Reply to author
Forward
0 new messages