Blame SOURCES/gdisk-CVE-2021-0308.patch

9e4196
From 28ac93e737ae4e2055ff23f2ea6021b1127b40a2 Mon Sep 17 00:00:00 2001
9e4196
From: Rod Smith <rodsmith@rodsbooks.com>
9e4196
Date: Wed, 13 Jan 2021 10:29:24 -0500
9e4196
Subject: [PATCH 2/2] Fix bug that could cause crash if a badly-formatted MBR
9e4196
 disk was read.
9e4196
9e4196
---
9e4196
 basicmbr.cc | 3 ++-
9e4196
 1 file changed, 2 insertions(+), 1 deletion(-)
9e4196
9e4196
diff --git a/basicmbr.cc b/basicmbr.cc
9e4196
index 8fbffd1..2da56db 100644
9e4196
--- a/basicmbr.cc
9e4196
+++ b/basicmbr.cc
9e4196
@@ -258,7 +258,8 @@ int BasicMBRData::ReadLogicalParts(uint64_t extendedStart, int partNum) {
9e4196
          if (EbrLocations[i] == offset) { // already read this one; infinite logical partition loop!
9e4196
             cerr << "Logical partition infinite loop detected! This is being corrected.\n";
9e4196
             allOK = -1;
9e4196
-            partNum -= 1;
9e4196
+            if (partNum > 0) //don't go negative
9e4196
+               partNum -= 1;
9e4196
          } // if
9e4196
       } // for
9e4196
       EbrLocations[partNum] = offset;
9e4196
-- 
9e4196
2.35.1
9e4196