From 8ade2c1776dc5e9c37cd1172031a02bfbdd07601 Mon Sep 17 00:00:00 2001 From: Zhihao Cheng Date: Sun, 4 Feb 2024 10:21:44 +0800 Subject: mkfs.ubifs: Initialize 'cipher_name' as NULL Variable 'cipher_name' is defined on stack without initialization, when an user invokes mkfs with '--key' and without '-C', 'cipher_name' is a random value, which could cause init_fscrypt_context() failed to find a valid cipher. Fix it by initializing 'cipher_name' as NULL when it is declared. Fixes: cc4c5e295f546 ("mkfs.ubifs: Enable support for building without crypto") Signed-off-by: Zhihao Cheng Signed-off-by: David Oberhollenzer --- ubifs-utils/mkfs.ubifs/mkfs.ubifs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ubifs-utils/mkfs.ubifs/mkfs.ubifs.c') diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c index 5ca0151..b91a3e2 100644 --- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c +++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c @@ -556,7 +556,7 @@ static int get_options(int argc, char**argv) struct stat st; char *endp; #ifdef WITH_CRYPTO - const char *cipher_name; + const char *cipher_name = NULL; #endif c->fanout = 8; -- cgit v1.2.3