bootloader_message: Add a magic header to the Virtual A/B message block.
This adds a sanity check in addition to the version number in case misc contains random bits. Bug: 139156011 Test: manual test Change-Id: Ie4f3731d2b1795340881c88e0c4eec9cd4432653
This commit is contained in:
@@ -365,13 +365,15 @@ bool InitMiscVirtualAbMessageIfNeeded() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (message.version == MISC_VIRTUAL_AB_MESSAGE_VERSION) {
|
||||
if (message.version == MISC_VIRTUAL_AB_MESSAGE_VERSION &&
|
||||
message.magic == MISC_VIRTUAL_AB_MAGIC_HEADER) {
|
||||
// Already initialized.
|
||||
return true;
|
||||
}
|
||||
|
||||
message = {};
|
||||
message.version = MISC_VIRTUAL_AB_MESSAGE_VERSION;
|
||||
message.magic = MISC_VIRTUAL_AB_MAGIC_HEADER;
|
||||
if (!WriteMiscVirtualAbMessage(message, &err)) {
|
||||
LOG(ERROR) << "Could not write merge status: " << err;
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user