Avoid array overrun. We can now mount the /sdcard partition on our boot sdcards
Orig-Change-Id: I6e9db8c55db49b4aa61dd40cd59495f55e5b3368
Signed-off-by: Bruce Beare <brucex.j.beare@intel.com>
diff --git a/DirectVolume.cpp b/DirectVolume.cpp
index 0ac1a0c..a570a73 100644
--- a/DirectVolume.cpp
+++ b/DirectVolume.cpp
@@ -202,9 +202,13 @@
#ifdef PARTITION_DEBUG
SLOGD("Dv:partAdd: part_num = %d, minor = %d\n", part_num, minor);
#endif
- mPartMinors[part_num -1] = minor;
-
+ if (part_num >= MAX_PARTITIONS) {
+ SLOGE("Dv:partAdd: ignoring part_num = %d (max: %d)\n", part_num, MAX_PARTITIONS-1);
+ } else {
+ mPartMinors[part_num -1] = minor;
+ }
mPendingPartMap &= ~(1 << part_num);
+
if (!mPendingPartMap) {
#ifdef PARTITION_DEBUG
SLOGD("Dv:partAdd: Got all partitions - ready to rock!");