All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Franke <Christian.Franke@t-online.de>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] Avoid crash on empty menu
Date: Sat, 10 Nov 2007 13:06:54 +0100	[thread overview]
Message-ID: <47359EDE.2000102@t-online.de> (raw)
In-Reply-To: <87ejezla2g.fsf@xs4all.nl>

[-- Attachment #1: Type: text/plain, Size: 357 bytes --]

Marco Gerards wrote:
>
>> +      e = get_entry (menu, boot_entry);
>> +      if (! e)
>> +	continue; /* menu is empty */
>>     
>
> Please use proper interpunctions for comments.
>
>   

Fixed.

Christian

2007-11-10  Christian Franke  <franke@computer.org>

	* normal/menu.c (run_menu): Check for empty menu to avoid crash.
	(grub_menu_run): Likewise.




[-- Attachment #2: grub2-menu-crash-2.patch --]
[-- Type: text/x-patch, Size: 822 bytes --]

--- grub2.orig/normal/menu.c	2007-08-20 16:35:20.000000000 +0200
+++ grub2/normal/menu.c	2007-11-10 12:59:54.953125000 +0100
@@ -412,7 +412,11 @@ run_menu (grub_menu_t menu, int nested)
 	      goto refresh;
 
 	    case 'e':
-	      grub_menu_entry_run (get_entry (menu, first + offset));
+		{
+		  grub_menu_entry_t e = get_entry (menu, first + offset);
+		  if (e)
+		    grub_menu_entry_run (e);
+		}
 	      goto refresh;
 	      
 	    default:
@@ -451,10 +455,13 @@ grub_menu_run (grub_menu_t menu, int nes
       if (boot_entry < 0)
 	break;
 
+      e = get_entry (menu, boot_entry);
+      if (! e)
+	continue; /* Menu is empty.  */
+	
       grub_cls ();
       grub_setcursor (1);
 
-      e = get_entry (menu, boot_entry);
       grub_printf ("  Booting \'%s\'\n\n", e->title);
   
       run_menu_entry (e);

  reply	other threads:[~2007-11-10 12:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-07 21:41 [PATCH] Avoid crash on empty menu Christian Franke
2007-11-09 15:20 ` Marco Gerards
2007-11-10 12:06   ` Christian Franke [this message]
2007-11-10 15:27     ` Marco Gerards
2007-11-10 20:32       ` Robert Millan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47359EDE.2000102@t-online.de \
    --to=christian.franke@t-online.de \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.