Merge "bootctrl: fixed OOB read in BootControl" into main

This commit is contained in:
Bryan Bong Gyoune Kim 2024-08-28 20:59:25 +00:00 committed by Android (Google) Code Review
commit d1f646d258

View file

@ -384,7 +384,7 @@ ScopedAStatus BootControl::isSlotMarkedSuccessful(int32_t in_slot, bool* _aidl_r
*_aidl_return = true; *_aidl_return = true;
return ScopedAStatus::ok(); return ScopedAStatus::ok();
} }
if (in_slot >= slots) if (in_slot < 0 || in_slot >= slots)
return ScopedAStatus::fromServiceSpecificErrorWithMessage( return ScopedAStatus::fromServiceSpecificErrorWithMessage(
INVALID_SLOT, (std::string("Invalid slot ") + std::to_string(in_slot)).c_str()); INVALID_SLOT, (std::string("Invalid slot ") + std::to_string(in_slot)).c_str());