* grub-core/normal/menu.c (grub_menu_execute_entry): Fix NULL

dereference.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-07-25 07:48:19 +02:00
parent 583168a216
commit b70e4cb08d
2 changed files with 10 additions and 2 deletions

View file

@ -1,3 +1,8 @@
2011-07-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/menu.c (grub_menu_execute_entry): Fix NULL
dereference.
2011-07-23 Vladimir Serbinenko <phcoder@gmail.com> 2011-07-23 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/disk/pata.c (grub_pata_readwrite): Add missing wait. * grub-core/disk/pata.c (grub_pata_readwrite): Add missing wait.

View file

@ -232,7 +232,8 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot)
grub_env_export ("chosen"); grub_env_export ("chosen");
grub_free (buf); grub_free (buf);
} }
for (ptr = def; *ptr; ptr++)
for (ptr = def; ptr && *ptr; ptr++)
{ {
if (ptr[0] == '>' && ptr[1] == '>') if (ptr[0] == '>' && ptr[1] == '>')
{ {
@ -242,10 +243,12 @@ grub_menu_execute_entry(grub_menu_entry_t entry, int auto_boot)
if (ptr[0] == '>') if (ptr[0] == '>')
break; break;
} }
if (ptr[0] && ptr[1])
if (ptr && ptr[0] && ptr[1])
grub_env_set ("default", ptr + 1); grub_env_set ("default", ptr + 1);
else else
grub_env_unset ("default"); grub_env_unset ("default");
grub_script_execute_sourcecode (entry->sourcecode, entry->argc, entry->args); grub_script_execute_sourcecode (entry->sourcecode, entry->argc, entry->args);
if (errs_before != grub_err_printed_errors) if (errs_before != grub_err_printed_errors)