From 9cd9fcf7acaeafaaa5a8cbb2d17a91bf7a21aaac Mon Sep 17 00:00:00 2001 From: Stefan Berger Date: Thu, 11 Jul 2024 16:04:03 -0400 Subject: [PATCH] tpm2: Initialize eccPublic before passing to TPMS_ECC_POINT_Unmarshal (Coverity) Resolve the following Coverity complaint: "Using uninitialized value eccPublic when calling TPMS_ECC_POINT_Unmarshal." Signed-off-by: Stefan Berger --- src/tpm2/CryptUtil.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tpm2/CryptUtil.c b/src/tpm2/CryptUtil.c index cf7506b2..d807a48c 100644 --- a/src/tpm2/CryptUtil.c +++ b/src/tpm2/CryptUtil.c @@ -781,6 +781,8 @@ CryptSecretDecrypt(OBJECT* decryptKey, // IN: decrypt key BYTE* buffer = secret->t.secret; INT32 size = secret->t.size; + MemorySet(&eccPublic, 0, sizeof(eccPublic)); // libtpms added: Coverity + // Retrieve ECC point from secret buffer result = TPMS_ECC_POINT_Unmarshal(&eccPublic, &buffer, &size); if(result == TPM_RC_SUCCESS)