diff options
author | Hridya Valsaraju <hridya@google.com> | 2018-10-09 10:40:35 -0700 |
---|---|---|
committer | Hridya Valsaraju <hridya@google.com> | 2018-10-09 13:32:04 -0700 |
commit | 4165e00d67f90136733bf90b3e21b9bc091f03c2 (patch) | |
tree | 86db2b240a4e3bbab4a5f932223c00f72ba064dc /fastboot/device/variables.cpp | |
parent | f3186de123c742166ec5e61b27b61af3ef929dfb (diff) |
Check validity of partition for getvar:partition-type
Test: fastboot getvar partition-type:product_services_a
Bug: 79480454
Change-Id: I4020b0c94daf8fb86c29104aecc1eb8f44f89999
Diffstat (limited to 'fastboot/device/variables.cpp')
-rw-r--r-- | fastboot/device/variables.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/fastboot/device/variables.cpp b/fastboot/device/variables.cpp index 2de79b18d..25042c9d6 100644 --- a/fastboot/device/variables.cpp +++ b/fastboot/device/variables.cpp @@ -309,7 +309,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"; |