Blame SOURCES/0001-tpm2-Fix-size-check-in-CryptSecretDecrypt.patch

d6ed27
From 3d2bbe2f1947784506ba0a7f9e8ab81eefb69929 Mon Sep 17 00:00:00 2001
d6ed27
From: Ross Lagerwall <ross.lagerwall@citrix.com>
d6ed27
Date: Mon, 23 May 2022 14:16:57 +0100
d6ed27
Subject: [PATCH] tpm2: Fix size check in CryptSecretDecrypt
d6ed27
d6ed27
Check the secret size against the size of the buffer, not the size
d6ed27
member that has not been set yet.
d6ed27
d6ed27
Reported by Coverity.
d6ed27
d6ed27
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
d6ed27
---
d6ed27
 src/tpm2/CryptUtil.c | 2 +-
d6ed27
 1 file changed, 1 insertion(+), 1 deletion(-)
d6ed27
d6ed27
diff --git a/src/tpm2/CryptUtil.c b/src/tpm2/CryptUtil.c
d6ed27
index 9879f918acb6..002fde0987a9 100644
d6ed27
--- a/src/tpm2/CryptUtil.c
d6ed27
+++ b/src/tpm2/CryptUtil.c
d6ed27
@@ -732,7 +732,7 @@ CryptSecretDecrypt(
d6ed27
 					     nonceCaller->t.size);
d6ed27
 			      }
d6ed27
 			  // make sure secret will fit
d6ed27
-			  if(secret->t.size > data->t.size)
d6ed27
+			  if(secret->t.size > sizeof(data->t.buffer))
d6ed27
 			      return TPM_RC_FAILURE;
d6ed27
 			  data->t.size = secret->t.size;
d6ed27
 			  // CFB decrypt, using nonceCaller as iv
d6ed27
-- 
d6ed27
2.36.0.44.g0f828332d5ac
d6ed27