From 444599e77a6c7f3c7f149ea7303e976b3c12124c 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 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/tpm2/CryptUtil.c b/src/tpm2/CryptUtil.c index 19f5cd6d..da4230e3 100644 --- a/src/tpm2/CryptUtil.c +++ b/src/tpm2/CryptUtil.c @@ -639,6 +639,9 @@ CryptSecretDecrypt( TPMS_ECC_POINT eccSecret; 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)