mirror of
https://github.com/systemd/systemd.git
synced 2026-08-13 17:08:14 +00:00
boot: add overflow check in GPT parser
ALIGN_TO() can overflow and return SIZE_MAX
CID#1644887
Follow-up for ccbd324a3a
This commit is contained in:
@@ -117,6 +117,8 @@ static EFI_STATUS try_gpt(
|
||||
|
||||
/* Now load the GPT entry table */
|
||||
size = ALIGN_TO((size_t) gpt->SizeOfPartitionEntry * (size_t) gpt->NumberOfPartitionEntries, 512);
|
||||
if (size == SIZE_MAX) /* overflow check */
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
entries_pages = xmalloc_aligned_pages(
|
||||
AllocateMaxAddress,
|
||||
EfiLoaderData,
|
||||
|
||||
Reference in New Issue
Block a user