summaryrefslogtreecommitdiffstats
path: root/bootloader_message/bootloader_message.cpp
diff options
context:
space:
mode:
authorDavid Anderson <dvander@google.com>2019-11-05 23:37:27 +0100
committerandroid-build-merger <android-build-merger@google.com>2019-11-05 23:37:27 +0100
commit1caaf1637951004baba62d720927a42d6750118c (patch)
treee05ea9fd88e06d3f6b8bbe192ee8ce742b67c1a3 /bootloader_message/bootloader_message.cpp
parentMerge "Start adbd in user mode if bootloader is unlocked" am: b65dd9cb0c (diff)
parentMerge "bootloader_message: Carve out space reserved for system." (diff)
downloadandroid_bootable_recovery-1caaf1637951004baba62d720927a42d6750118c.tar
android_bootable_recovery-1caaf1637951004baba62d720927a42d6750118c.tar.gz
android_bootable_recovery-1caaf1637951004baba62d720927a42d6750118c.tar.bz2
android_bootable_recovery-1caaf1637951004baba62d720927a42d6750118c.tar.lz
android_bootable_recovery-1caaf1637951004baba62d720927a42d6750118c.tar.xz
android_bootable_recovery-1caaf1637951004baba62d720927a42d6750118c.tar.zst
android_bootable_recovery-1caaf1637951004baba62d720927a42d6750118c.zip
Diffstat (limited to 'bootloader_message/bootloader_message.cpp')
-rw-r--r--bootloader_message/bootloader_message.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/bootloader_message/bootloader_message.cpp b/bootloader_message/bootloader_message.cpp
index b15a9b9fd..f838930fd 100644
--- a/bootloader_message/bootloader_message.cpp
+++ b/bootloader_message/bootloader_message.cpp
@@ -250,6 +250,13 @@ bool write_wipe_package(const std::string& package_data, std::string* err) {
if (misc_blk_device.empty()) {
return false;
}
+ static constexpr size_t kMaximumWipePackageSize =
+ SYSTEM_SPACE_OFFSET_IN_MISC - WIPE_PACKAGE_OFFSET_IN_MISC;
+ if (package_data.size() > kMaximumWipePackageSize) {
+ *err = "Wipe package size " + std::to_string(package_data.size()) + " exceeds " +
+ std::to_string(kMaximumWipePackageSize) + " bytes";
+ return false;
+ }
return write_misc_partition(package_data.data(), package_data.size(), misc_blk_device,
WIPE_PACKAGE_OFFSET_IN_MISC, err);
}