All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Hindoe Paaboel Andersen <phomes@gmail.com>
To: ell@lists.01.org
Subject: [PATCH] key: return proper value and avoid leak
Date: Tue, 11 Oct 2016 23:38:04 +0200	[thread overview]
Message-ID: <20161011213804.25873-1-phomes@gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 731 bytes --]

The return value was incorrect for bool. The code should also go to
'done' to free sig_hash.
---
 ell/key.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/ell/key.c b/ell/key.c
index ad88d81..a71bdc8 100644
--- a/ell/key.c
+++ b/ell/key.c
@@ -603,8 +603,10 @@ LIB_EXPORT bool l_key_verify(struct l_key *key,
 	uint8_t *sig_hash = l_malloc(len_sig);
 
 	/* Other checksum types are not yet supported */
-	if (checksum != L_CHECKSUM_NONE)
-		return -EINVAL;
+	if (checksum != L_CHECKSUM_NONE) {
+		success = false;
+		goto done;
+	}
 
 	/* The keyctl verify implementation compares the verify results
 	 * before we get a chance to unpad it. Instead, use the *encrypt*
-- 
2.9.3


             reply	other threads:[~2016-10-11 21:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-11 21:38 Thomas Hindoe Paaboel Andersen [this message]
2016-10-12 15:46 ` [PATCH] key: return proper value and avoid leak Denis Kenzior

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=20161011213804.25873-1-phomes@gmail.com \
    --to=phomes@gmail.com \
    --cc=ell@lists.01.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.