Blame SOURCES/0001-tpm2-Initialize-a-whole-OBJECT-before-using-it.patch

ffd936
From 4b1a4e5bfa4ad797050cbb323671b50d4a2367d5 Mon Sep 17 00:00:00 2001
ffd936
From: Stefan Berger <stefanb@linux.vnet.ibm.com>
ffd936
Date: Thu, 22 Jul 2021 21:23:58 -0400
ffd936
Subject: [PATCH 1/2] tpm2: Initialize a whole OBJECT before using it
ffd936
ffd936
Initialize a whole OBJECT before using it. This is necessary since
ffd936
an OBJECT may also be used as a HASH_OBJECT via the ANY_OBJECT
ffd936
union and that HASH_OBJECT can leave bad size inidicators in TPM2B
ffd936
buffer in the OBJECT. To get rid of this problem we reset the whole
ffd936
OBJECT to 0 before using it. This is as if the memory for the
ffd936
OBJECT was just initialized.
ffd936
ffd936
Signed-off-by: Stefan Berger <stefanb@linux.ibm.com>
ffd936
---
ffd936
 src/tpm2/Object.c | 3 ++-
ffd936
 1 file changed, 2 insertions(+), 1 deletion(-)
ffd936
ffd936
diff --git a/src/tpm2/Object.c b/src/tpm2/Object.c
ffd936
index a70254c..bd98fd9 100644
ffd936
--- a/src/tpm2/Object.c
ffd936
+++ b/src/tpm2/Object.c
ffd936
@@ -284,7 +284,8 @@ FindEmptyObjectSlot(
ffd936
 		    if(handle)
ffd936
 			*handle = i + TRANSIENT_FIRST;
ffd936
 		    // Initialize the object attributes
ffd936
-		    MemorySet(&object->attributes, 0, sizeof(OBJECT_ATTRIBUTES));
ffd936
+		    // MemorySet(&object->attributes, 0, sizeof(OBJECT_ATTRIBUTES));
ffd936
+		    MemorySet(object, 0, sizeof(*object)); // libtpms added: Initialize the whole object
ffd936
 		    return object;
ffd936
 		}
ffd936
 	}
ffd936
-- 
ffd936
2.33.0.rc2
ffd936