arrfab / rpms / shim

Forked from rpms/shim 4 years ago
Clone
Blob Blame History Raw
From c622b677d67ebd88b94f13555b30da80ca74a8c1 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Sun, 21 Sep 2014 13:45:38 -0400
Subject: [PATCH 72/74] Make another integer compare be signed/unsigned safe as
 well.

Signed-off-by: Peter Jones <pjones@redhat.com>
---
 MokManager.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MokManager.c b/MokManager.c
index 4a9b102..ee29051 100644
--- a/MokManager.c
+++ b/MokManager.c
@@ -192,7 +192,8 @@ static MokListNode *build_mok_list(UINT32 num, void *Data, UINTN DataSize) {
 		list[count].Type = CertList->SignatureType;
 
 		/* MOK out of bounds? */
-		if (list[count].MokSize > end - (void *)list[count].Mok) {
+		if (list[count].MokSize > (unsigned long)end -
+					  (unsigned long)list[count].Mok) {
 			FreePool(list);
 			return NULL;
 		}
-- 
1.9.3