aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@HansenPartnership.com>2023-03-17 16:56:21 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2023-03-17 16:56:21 -0400
commit3e202ac1b6191cbd818f9d4922ba46e4425cb249 (patch)
tree7ce135e05f971c2ef98482ea16ef11a3eb4bd2d7
parentc4033c4a8dbefc8624aa9ed447397520e4b023c9 (diff)
downloadopenssl_tpm2_engine-3e202ac1b6191cbd818f9d4922ba46e4425cb249.tar.gz
tpm2-common.c: fix uninitialized variable in tpm2_try_policy()
tpm2_try_policy() can be handed a zero length policy to check if a signed policy consists of just one element. For this case it returns the initial value of RC, which is uninitialized. Fix by setting it to TPM_RC_SUCCESS. Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
-rw-r--r--src/libcommon/tpm2-common.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcommon/tpm2-common.c b/src/libcommon/tpm2-common.c
index c6e0461..27d7bf5 100644
--- a/src/libcommon/tpm2-common.c
+++ b/src/libcommon/tpm2-common.c
@@ -1148,7 +1148,7 @@ static TPM_RC tpm2_try_policy(TSS_CONTEXT *tssContext, TPM_HANDLE handle,
{
INT32 size;
BYTE *policy;
- TPM_RC rc, reason_rc = 0;
+ TPM_RC rc = TPM_RC_SUCCESS, reason_rc = 0;
int i;
char reason[256];
int name_alg_size = TSS_GetDigestSize(name_alg);