extract_legacy_entries_source hoses system when menu.lst can't be opened
Hi there,
In grub_cmd_legacy_source, if the menu.lst file cannot opened inlegacy_file(), grub_env_extractor_close() attempts to access memory at address 4, which could end up corrupting the entire menu.
The easy fix is to check if the first call to grub_env_get_menu() returns
NULL and bail out (after the grub_env_context_close() and grub_extractor_level--, of course), since there's no point trying to append menu entries to the prev menu (since there are none).
--S
grub-core/normal/context.c +1 -1
@@ -159,7 +159,7 @@ } err =grub_env_context_close (); -if (source) +if (source && menu) {grub_menu_t menu2; menu2 =grub_env_get_menu ();