:: commit 3c272f13bcf3935c1ed3a0be34d8058eb7d9d50f

Mintsuki <mintsuki@protonmail.com> — 2026-04-12 22:40

parents: 6316c6a857

menu: Fix NULL dereference when DEFAULT_ENTRY is out of range with TIMEOUT=0

diff --git a/common/menu.c b/common/menu.c
index 14e9fdbe..7d71a9ab 100644
--- a/common/menu.c
+++ b/common/menu.c
@@ -1322,7 +1322,7 @@ noreturn void _menu(bool first_run) {
     }
 
     if (!skip_timeout && !timeout) {
-        if (max_entries == 0 || selected_menu_entry->sub != NULL) {
+        if (max_entries == 0 || selected_menu_entry == NULL || selected_menu_entry->sub != NULL) {
             quiet = false;
             print("Default entry is not valid or directory, booting to menu.\n");
             skip_timeout = true;
tab: 248 wrap: offon