summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhihao Cheng <chengzhihao1@huawei.com>2024-02-04 10:21:44 +0800
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2024-09-25 09:08:41 +0200
commit8ade2c1776dc5e9c37cd1172031a02bfbdd07601 (patch)
treeb03793b416bee833b109430ff22a6862eec90d3f
parent1ffb962afe2239ac02e3890df29653d84f07b104 (diff)
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 <chengzhihao1@huawei.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--ubifs-utils/mkfs.ubifs/mkfs.ubifs.c2
1 files changed, 1 insertions, 1 deletions
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;