Hi list...
Happy to join you...
Attached you find a patch that resolves an integer-overflow.
It hits when you request UINT32_MAX events starting at a non-Zero-Index.
Cheers,
Andreas
From 66bffecc71d800e63651596d19fa1785362e8608 Mon Sep 17 00:00:00 2001
From: Andreas Fuchs <[email protected]>
Date: Tue, 7 May 2013 16:20:52 +0200
Subject: [PATCH] Fixed UINT32-Overflow in Minimum-Calculation
---
src/tcs/tcsi_evlog.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/src/tcs/tcsi_evlog.c b/src/tcs/tcsi_evlog.c
index 7d49600..dd2682e 100644
--- a/src/tcs/tcsi_evlog.c
+++ b/src/tcs/tcsi_evlog.c
@@ -249,7 +249,7 @@ TCS_GetPcrEventsByPcr_Internal(TCS_CONTEXT_HANDLE hContext, /* in */
return TCSERR(TSS_E_BAD_PARAMETER);
/* if this is a kernel or firmware controlled PCR, call an external routine */
- if ((tcsd_options.kernel_pcrs & (1 << PcrIndex)) ||
+ if ((tcsd_options.kernel_pcrs & (1 << PcrIndex)) ||
(tcsd_options.firmware_pcrs & (1 << PcrIndex))) {
MUTEX_LOCK(tcs_event_log->lock);
result = TCS_GetExternalPcrEventsByPcr(PcrIndex, FirstEvent,
@@ -262,13 +262,18 @@ TCS_GetPcrEventsByPcr_Internal(TCS_CONTEXT_HANDLE hContext, /* in */
MUTEX_LOCK(tcs_event_log->lock);
lastEventNumber = get_num_events(PcrIndex);
+ LogDebug("Retrieving %u events from PCR %u (internal)", lastEventNumber, PcrIndex);
MUTEX_UNLOCK(tcs_event_log->lock);
/* if pEventCount is larger than the number of events to return, just return less.
* *pEventCount will be set to the number returned below.
+ * However we need to make sure we have no overflow during addition...
*/
- lastEventNumber = MIN(lastEventNumber, FirstEvent + *pEventCount);
+ if (FirstEvent + *pEventCount < FirstEvent || FirstEvent + *pEventCount < *pEventCount)
+ lastEventNumber = lastEventNumber;
+ else
+ lastEventNumber = MIN(lastEventNumber, FirstEvent + *pEventCount);
if (FirstEvent > lastEventNumber)
return TCSERR(TSS_E_BAD_PARAMETER);
@@ -344,6 +349,8 @@ TCS_GetPcrEventLog_Internal(TCS_CONTEXT_HANDLE hContext,/* in */
/* A TCSD controlled PCR event list */
event_count = get_num_events(i);
+ LogDebug("Retrieving %u events from PCR %u (internal)", event_count, i);
+
if (event_count == 0)
continue;
--
1.7.10.4
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and
their applications. This 200-page book is written by three acclaimed
leaders in the field. The early access version is available now.
Download your free book today! http://p.sf.net/sfu/neotech_d2d_may
_______________________________________________
TrouSerS-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/trousers-tech