From b4af096b5df5dd131ab796c79cedc7069d8f4882 Mon Sep 17 00:00:00 2001 From: Chen Ni Date: Wed, 8 Nov 2023 07:36:27 +0000 Subject: KEYS: encrypted: Add check for strsep Add check for strsep() in order to transfer the error. Fixes: cd3bc044af48 ("KEYS: encrypted: Instantiate key with user-provided decrypted data") Signed-off-by: Chen Ni Signed-off-by: Mimi Zohar --- security/keys/encrypted-keys/encrypted.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'security/keys') diff --git a/security/keys/encrypted-keys/encrypted.c b/security/keys/encrypted-keys/encrypted.c index 8af2136069d2..76f55dd13cb8 100644 --- a/security/keys/encrypted-keys/encrypted.c +++ b/security/keys/encrypted-keys/encrypted.c @@ -237,6 +237,10 @@ static int datablob_parse(char *datablob, const char **format, break; } *decrypted_data = strsep(&datablob, " \t"); + if (!*decrypted_data) { + pr_info("encrypted_key: decrypted_data is missing\n"); + break; + } ret = 0; break; case Opt_load: -- cgit v1.2.3-58-ga151