From: Martin Willi Date: Thu, 9 Jan 2014 16:29:35 +0000 (+0100) Subject: libpts: Fix PCR read, avoid cast of a pointer to different sized integer X-Git-Tag: 5.2.0dr6~24^2~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2877355408d539af08b85586e1f30bceaa2933e1;p=thirdparty%2Fstrongswan.git libpts: Fix PCR read, avoid cast of a pointer to different sized integer --- diff --git a/src/libpts/pts/pts.c b/src/libpts/pts/pts.c index 075af5bcc0..b82b744054 100644 --- a/src/libpts/pts/pts.c +++ b/src/libpts/pts/pts.c @@ -623,7 +623,8 @@ METHOD(pts_t, read_pcr, bool, TSS_HCONTEXT hContext; TSS_HTPM hTPM; TSS_RESULT result; - chunk_t rgbPcrValue; + BYTE *buf; + UINT32 len; bool success = FALSE; @@ -644,12 +645,12 @@ METHOD(pts_t, read_pcr, bool, { goto err; } - result = Tspi_TPM_PcrRead(hTPM, pcr_num, (UINT32*)&rgbPcrValue.len, &rgbPcrValue.ptr); + result = Tspi_TPM_PcrRead(hTPM, pcr_num, &len, &buf); if (result != TSS_SUCCESS) { goto err; } - *pcr_value = chunk_clone(rgbPcrValue); + *pcr_value = chunk_clone(chunk_create(buf, len)); DBG3(DBG_PTS, "PCR %d value:%B", pcr_num, pcr_value); success = TRUE;