diff options
author | Rod Smith <rodsmith@rodsbooks.com> | 2021-01-13 10:29:24 -0500 |
---|---|---|
committer | Rod Smith <rodsmith@rodsbooks.com> | 2021-01-13 10:29:24 -0500 |
commit | f523bbc0c2437fe259aa3aff5e819e24101aee29 (patch) | |
tree | 17c0870eea4b0223142c5958821ddaaa6b761631 | |
parent | ee3abf6f6d109c9ad37193bd710de7c774e37714 (diff) | |
download | sgdisk-f523bbc0c2437fe259aa3aff5e819e24101aee29.tar.gz |
Fix bug that could cause crash if a badly-formatted MBR disk was read.
-rw-r--r-- | basicmbr.cc | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/basicmbr.cc b/basicmbr.cc index dd48706..c266e39 100644 --- a/basicmbr.cc +++ b/basicmbr.cc @@ -290,7 +290,8 @@ int BasicMBRData::ReadLogicalParts(uint64_t extendedStart, int partNum) { if (EbrLocations[i] == offset) { // already read this one; infinite logical partition loop! cerr << "Logical partition infinite loop detected! This is being corrected.\n"; allOK = -1; - partNum -= 1; + if (partNum > 0) //don't go negative + partNum -= 1; } // if } // for EbrLocations[partNum] = offset; |