Linux-Security-Module Archive mirror
 help / color / mirror / Atom feed
From: Chen Ni <nichen@iscas.ac.cn>
To: zohar@linux.ibm.com, dhowells@redhat.com, jarkko@kernel.org,
	paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com,
	sumit.garg@linaro.org, yaelt@google.com
Cc: linux-integrity@vger.kernel.org, keyrings@vger.kernel.org,
	linux-security-module@vger.kernel.org,
	linux-kernel@vger.kernel.org, Chen Ni <nichen@iscas.ac.cn>
Subject: [PATCH] KEYS: encrypted: Add check for strsep
Date: Wed,  8 Nov 2023 07:36:27 +0000	[thread overview]
Message-ID: <20231108073627.1063464-1-nichen@iscas.ac.cn> (raw)

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


             reply	other threads:[~2023-11-08  7:46 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-08  7:36 Chen Ni [this message]
2024-01-24 18:21 ` [PATCH] KEYS: encrypted: Add check for strsep 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231108073627.1063464-1-nichen@iscas.ac.cn \
    --to=nichen@iscas.ac.cn \
    --cc=dhowells@redhat.com \
    --cc=jarkko@kernel.org \
    --cc=jmorris@namei.org \
    --cc=keyrings@vger.kernel.org \
    --cc=linux-integrity@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-security-module@vger.kernel.org \
    --cc=paul@paul-moore.com \
    --cc=serge@hallyn.com \
    --cc=sumit.garg@linaro.org \
    --cc=yaelt@google.com \
    --cc=zohar@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).