Skip to contentSkip to conversation

key: return proper value and avoid leak

PATCH Applied Thomas Hindoe Paaboel Andersen 2 participants 2 messages Oct 11, 2016 – Oct 12, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 key: return proper value and avoid leak

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(-)
ell/key.c +4 -2
index ad88d81..a71bdc8 100644
@@ -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*
Signature · 1 line
2.9.3
#1 lore raw

Hi Thomas,

Quoted 6 lines · Thomas Hindoe Paaboel Andersen

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(-)

Applied, thanks.

Regards,
-Denis