From f3d3ce5e53ab7928f4c292c183c417a1bd051151 Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Mon, 18 Apr 2011 11:16:13 -0700 Subject: [PATCH] add bounds checking for mPartMinors[] Change-Id: I6d5b26756c8434d6396f3535252608ce61eabfd8 --- DirectVolume.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/DirectVolume.cpp b/DirectVolume.cpp index ce5b892..0ac1a0c 100644 --- a/DirectVolume.cpp +++ b/DirectVolume.cpp @@ -186,6 +186,11 @@ void DirectVolume::handlePartitionAdded(const char *devpath, NetlinkEvent *evt) part_num = 1; } + if (part_num > MAX_PARTITIONS || part_num < 1) { + SLOGW("Invalid 'PARTN' value"); + part_num = 1; + } + if (part_num > mDiskNumParts) { mDiskNumParts = part_num; }