From: Luca Boccassi Date: Sat, 28 Mar 2026 18:29:28 +0000 (+0000) Subject: boot: add overflow check in GPT parser X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=85b20f5fa7291eaf7effe62d88a8c0d5b79eee7c;p=thirdparty%2Fsystemd.git boot: add overflow check in GPT parser ALIGN_TO() can overflow and return SIZE_MAX CID#1644887 Follow-up for ccbd324a3a522362de0863e8d06cdd06a58d2fca --- diff --git a/src/boot/part-discovery.c b/src/boot/part-discovery.c index dc1aed0514b..25f60521acf 100644 --- a/src/boot/part-discovery.c +++ b/src/boot/part-discovery.c @@ -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,