:: commit 201055e1b70bd24b75c1690d5e69ada5a0c88541

Mintsuki <mintsuki@protonmail.com> — 2025-08-16 06:16

parents: 32e3de15b0

host/limine: Ensure GPT BIOS partition is at least 32KiB

diff --git a/host/limine.c b/host/limine.c
index 31c2ce15..55c4bb40 100644
--- a/host/limine.c
+++ b/host/limine.c
@@ -1029,6 +1029,11 @@ part_too_low:
                 goto cleanup;
             }
 
+            if (((ENDSWAP(gpt_entry.ending_lba) - ENDSWAP(gpt_entry.starting_lba)) + 1) * lb_size < 32768) {
+                fprintf(stderr, "%s: error: Partition with index `%s` is smaller than 32KiB.\n", program_name, part_ndx);
+                goto cleanup;
+            }
+
             if (!quiet) {
                 fprintf(stderr, "Installing BIOS boot code to partition %s.\n", part_ndx);
             }
tab: 248 wrap: offon