mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-03-23 16:04:34 +08:00
[drivers][block][efi] Fix GPT partition entry underflow vulnerability
Co-authored-by: BernardXiong <1241087+BernardXiong@users.noreply.github.com>
This commit is contained in:
@@ -454,9 +454,13 @@ _fail:
|
||||
*/
|
||||
rt_inline rt_bool_t is_pte_valid(const gpt_entry *pte, const rt_size_t lastlba)
|
||||
{
|
||||
rt_uint64_t start = rt_le64_to_cpu(pte->starting_lba);
|
||||
rt_uint64_t end = rt_le64_to_cpu(pte->ending_lba);
|
||||
|
||||
if ((!efi_guidcmp(pte->partition_type_guid, NULL_GUID)) ||
|
||||
rt_le64_to_cpu(pte->starting_lba) > lastlba ||
|
||||
rt_le64_to_cpu(pte->ending_lba) > lastlba)
|
||||
start > lastlba ||
|
||||
end > lastlba ||
|
||||
end < start)
|
||||
{
|
||||
return RT_FALSE;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user