From d11b833201ae72265d52d606fa084841b44e9a65 Mon Sep 17 00:00:00 2001 From: Bruce Beare Date: Thu, 22 Jul 2010 13:23:33 -0700 Subject: [PATCH] Avoid array overrun. We can now mount the /sdcard partition on our boot sdcards Orig-Change-Id: I6e9db8c55db49b4aa61dd40cd59495f55e5b3368 Signed-off-by: Bruce Beare --- DirectVolume.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/DirectVolume.cpp b/DirectVolume.cpp index 0ac1a0c..a570a73 100644 --- a/DirectVolume.cpp +++ b/DirectVolume.cpp @@ -202,9 +202,13 @@ void DirectVolume::handlePartitionAdded(const char *devpath, NetlinkEvent *evt) #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!");