Discussion:
[Trousers-scm] [GIT] Trousers master branch updated. TROUSERS_0_3_12-3-gc6fe2de
Richard Maciel
2013-10-28 18:34:42 UTC
Permalink
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Trousers".

The branch, master has been updated
via c6fe2de315610d00bf1def7e01e66fe44f7f0cdb (commit)
from 971468df63a34508add7492193b4a27c264b72d1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://trousers.git.sourceforge.net/git/gitweb.cgi?p=trousers/trousers;a=commitdiff;h=c6fe2de315610d00bf1def7e01e66fe44f7f0cdb

commit c6fe2de315610d00bf1def7e01e66fe44f7f0cdb
Author: Ceri Coburn <***@gmail.com>
Date: Thu Oct 24 10:42:41 2013 +0100

Fixed 2 memory leaks inside Tspi_Key_CertifyKey, CertifyInfo and outData structures

Signed-off-by: Ceri Coburn <***@gmail.com>
Acked-by: Joel Schopp <***@linux.vnet.ibm.com>
Tested-by: Richard Maciel <***@linux.vnet.ibm.com>

diff --git a/src/tspi/tspi_certify.c b/src/tspi/tspi_certify.c
index 795d2d4..39dc568 100644
--- a/src/tspi/tspi_certify.c
+++ b/src/tspi/tspi_certify.c
@@ -122,43 +122,53 @@ Tspi_Key_CertifyKey(TSS_HKEY hKey, /* in */
result |= Trspi_Hash_UINT32(&hashCtx, outDataSize);
result |= Trspi_HashUpdate(&hashCtx, outDataSize, outData);
if ((result |= Trspi_HashFinal(&hashCtx, digest.digest)))
- return result;
+ goto cleanup;

if (useAuthKey)
if ((result = obj_policy_validate_auth_oiap(hPolicy, &digest, &keyAuth)))
- return result;
+ goto cleanup;

if (useAuthCert)
if ((result = obj_policy_validate_auth_oiap(hCertPolicy, &digest,
&certAuth)))
- return result;
+ goto cleanup;
}

if (pValidationData == NULL) {
if ((result = Trspi_Hash(TSS_HASH_SHA1, CertifyInfoSize, CertifyInfo,
digest.digest)))
- return result;
+ goto cleanup;
+

if ((result = __tspi_rsa_verify(hCertifyingKey, TSS_HASH_SHA1, TPM_SHA1_160_HASH_LEN,
- digest.digest, outDataSize, outData)))
- return TSPERR(TSS_E_VERIFICATION_FAILED);
+ digest.digest, outDataSize, outData))){
+ result = TSPERR(TSS_E_VERIFICATION_FAILED);
+ goto cleanup;
+ }
} else {
pValidationData->ulDataLength = CertifyInfoSize;
pValidationData->rgbData = calloc_tspi(tspContext, CertifyInfoSize);
if (pValidationData->rgbData == NULL) {
LogError("malloc of %u bytes failed.", CertifyInfoSize);
- return TSPERR(TSS_E_OUTOFMEMORY);
+ result = TSPERR(TSS_E_OUTOFMEMORY);
+ goto cleanup;
}
memcpy(pValidationData->rgbData, CertifyInfo, CertifyInfoSize);
pValidationData->ulValidationDataLength = outDataSize;
pValidationData->rgbValidationData = calloc_tspi(tspContext, outDataSize);
if (pValidationData->rgbValidationData == NULL) {
LogError("malloc of %u bytes failed.", outDataSize);
- return TSPERR(TSS_E_OUTOFMEMORY);
+ result = TSPERR(TSS_E_OUTOFMEMORY);
+ goto cleanup;
}
memcpy(pValidationData->rgbValidationData, outData, outDataSize);
}

- return TSS_SUCCESS;
+ result = TSS_SUCCESS;
+
+ cleanup:
+ free(CertifyInfo);
+ free(outData);
+ return result;
}


-----------------------------------------------------------------------

Summary of changes:
src/tspi/tspi_certify.c | 28 +++++++++++++++++++---------
1 files changed, 19 insertions(+), 9 deletions(-)


hooks/post-receive
--
Trousers
Loading...