mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-03-23 17:48:27 +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_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)) ||
|
if ((!efi_guidcmp(pte->partition_type_guid, NULL_GUID)) ||
|
||||||
rt_le64_to_cpu(pte->starting_lba) > lastlba ||
|
start > lastlba ||
|
||||||
rt_le64_to_cpu(pte->ending_lba) > lastlba)
|
end > lastlba ||
|
||||||
|
end < start)
|
||||||
{
|
{
|
||||||
return RT_FALSE;
|
return RT_FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user