:: commit bdf9b21971ff460f3c377b3bf4b0bdb57cb5599e

Mintsuki <mintsuki@protonmail.com> — 2026-02-08 06:31

parents: ba28de10cc

menu: NUL-terminate LimineLastBootedEntry variable after read

diff --git a/common/menu.c b/common/menu.c
index 71ce8e7d..a80e76c3 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -1002,6 +1002,8 @@ noreturn void _menu(bool first_run) {
                              NULL,
                              &getvar_size,
                              last_entry_path) == 0 && getvar_size > 0) {
+            // Ensure NUL termination
+            last_entry_path[getvar_size < sizeof(last_entry_path) ? getvar_size : sizeof(last_entry_path) - 1] = '\0';
             // Find the entry with this path, expand directories, and get its index.
             struct menu_entry *found_entry = NULL;
             size_t found_index = 0;
tab: 248 wrap: offon