Merge the 2021-02-05 SPL branch from AOSP-Partner
* security-aosp-pi-release:
RESTRICT AUTOMERGE ANDROID: Fix negative stack write in sgdisk
Change-Id: I5bf5f34928133c577a86521c86c84fbde3b947b1
diff --git a/basicmbr.cc b/basicmbr.cc
index 23f35b4..81e42ca 100644
--- a/basicmbr.cc
+++ b/basicmbr.cc
@@ -260,7 +260,8 @@
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;