:: commit 4bc0ca6b31e939e552b951bca255efc1b0cfd5e6

Mintsuki <mintsuki@protonmail.com> — 2025-12-26 10:35

parents: 3e41ea363e

protos/linux: Add E820 entries bounds check

diff --git a/common/protos/linux_x86.c b/common/protos/linux_x86.c
index c6f544be..f9fba8e5 100644
--- a/common/protos/linux_x86.c
+++ b/common/protos/linux_x86.c
@@ -597,6 +597,9 @@ no_fb:;
         if (mmap[i].type >= 0x1000) {
             continue;
         }
+        if (j >= E820_MAX_ENTRIES_ZEROPAGE) {
+            panic(false, "linux: Too many E820 memory map entries");
+        }
         e820_table[j].addr = mmap[i].base;
         e820_table[j].size = mmap[i].length;
         e820_table[j].type = mmap[i].type;
tab: 248 wrap: offon