linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KEYS: encrypted: Add check for strsep
@ 2023-11-08  7:36 Chen Ni
  2024-01-24 18:21 ` Verma, Vishal L
  0 siblings, 1 reply; 14+ messages in thread
From: Chen Ni @ 2023-11-08  7:36 UTC (permalink / raw)
  To: zohar, dhowells, jarkko, paul, jmorris, serge, sumit.garg, yaelt
  Cc: linux-integrity, keyrings, linux-security-module, linux-kernel,
	Chen Ni

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 <nichen@iscas.ac.cn>
---
 security/keys/encrypted-keys/encrypted.c | 4 ++++
 1 file changed, 4 insertions(+)

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:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2024-02-12  5:12 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-08  7:36 [PATCH] KEYS: encrypted: Add check for strsep Chen Ni
2024-01-24 18:21 ` Verma, Vishal L
2024-01-24 19:15   ` Mimi Zohar
2024-01-24 20:10     ` Verma, Vishal L
2024-01-24 20:40       ` Mimi Zohar
2024-01-24 21:10         ` Verma, Vishal L
2024-01-30 17:22           ` Jarkko Sakkinen
2024-01-30 17:30             ` Jarkko Sakkinen
2024-01-30 18:25               ` Dan Williams
2024-02-01 21:43                 ` Jarkko Sakkinen
2024-02-02  0:05                   ` Mimi Zohar
2024-02-12  5:11                     ` Jarkko Sakkinen
2024-01-30 17:19   ` Jarkko Sakkinen
2024-01-30 17:20     ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).