summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTreehugger Robot <treehugger-gerrit@google.com>2018-10-09 23:21:54 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2018-10-09 23:21:54 +0000
commit9810709d916cf0cc8b462e28dc43dc053dbb0ef5 (patch)
tree87912afb6337924d1239ebd750b10d0ade6bd9ca
parentb2263b4a075f93cc487c6e7e7cfc6e33afdf6ff9 (diff)
parent4165e00d67f90136733bf90b3e21b9bc091f03c2 (diff)
downloadsystem_core-9810709d916cf0cc8b462e28dc43dc053dbb0ef5.tar.gz
system_core-9810709d916cf0cc8b462e28dc43dc053dbb0ef5.tar.bz2
system_core-9810709d916cf0cc8b462e28dc43dc053dbb0ef5.zip
Merge "Check validity of partition for getvar:partition-type"
-rw-r--r--fastboot/device/variables.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/fastboot/device/variables.cpp b/fastboot/device/variables.cpp
index c8756aedb..cbd2856dc 100644
--- a/fastboot/device/variables.cpp
+++ b/fastboot/device/variables.cpp
@@ -308,7 +308,14 @@ bool GetPartitionType(FastbootDevice* device, const std::vector<std::string>& ar
*message = "Missing argument";
return false;
}
+
std::string partition_name = args[0];
+ if (!FindPhysicalPartition(partition_name) &&
+ !LogicalPartitionExists(partition_name, device->GetCurrentSlot())) {
+ *message = "Invalid partition";
+ return false;
+ }
+
auto fastboot_hal = device->fastboot_hal();
if (!fastboot_hal) {
*message = "Fastboot HAL not found";