tss2/SOURCES/0001-tss2-fix-bounds-check-in-IMA_Event_PcrExtend.patch

32 lines
1.1 KiB
Diff
Raw Normal View History

2019-08-02 21:22:00 +00:00
From 8f232900d3b8f8af65a029f49c17ee53d3cca122 Mon Sep 17 00:00:00 2001
From: Jerry Snitselaar <jsnitsel@redhat.com>
Date: Thu, 6 Jun 2019 14:53:18 -0700
Subject: [PATCH] tss2: fix bounds check in IMA_Event_PcrExtend
pcrs is declared with IMPLEMENTATION_PCR elements,
so the index bounds check should be >= IMPLEMENTATION_PCR
since indexing at value IMPLEMENTATION_PCR would be off the
end of the array. This was flagged by coverity.
Signed-off-by: Jerry Snitselaar <jsnitsel@redhat.com>
---
utils/imalib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/imalib.c b/utils/imalib.c
index 4957c1b..a841cd6 100644
--- a/utils/imalib.c
+++ b/utils/imalib.c
@@ -1306,7 +1306,7 @@ uint32_t IMA_Event_PcrExtend(TPMT_HA pcrs[IMA_PCR_BANKS][IMPLEMENTATION_PCR],
/* validate PCR number */
if (rc == 0) {
- if (imaEvent->pcrIndex > IMPLEMENTATION_PCR) {
+ if (imaEvent->pcrIndex >= IMPLEMENTATION_PCR) {
printf("ERROR: IMA_Event_PcrExtend: PCR number %u out of range\n", imaEvent->pcrIndex);
rc = TSS_RC_BAD_PROPERTY;
}
--
2.21.0