From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with archive (Exim 4.43) id 1Iqp7P-00063r-Lu for mharc-grub-devel@gnu.org; Sat, 10 Nov 2007 07:07:19 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Iqp7O-00063J-Ky for grub-devel@gnu.org; Sat, 10 Nov 2007 07:07:18 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Iqp7K-0005zG-81 for grub-devel@gnu.org; Sat, 10 Nov 2007 07:07:17 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iqp7K-0005z1-3X for grub-devel@gnu.org; Sat, 10 Nov 2007 07:07:14 -0500 Received: from mailout02.sul.t-online.de ([194.25.134.17] helo=mailout02.sul.t-online.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Iqp7J-00088p-Qi for grub-devel@gnu.org; Sat, 10 Nov 2007 07:07:14 -0500 Received: from fwd28.aul.t-online.de by mailout02.sul.t-online.com with smtp id 1Iqp7I-0000e1-05; Sat, 10 Nov 2007 13:07:12 +0100 Received: from [10.3.2.2] (TQXLfwZfZhsiJGoHUIScby-mJ-eavXlxwFVDRatFWZtiqELWyslCMtFhJX8xjdug1C@[217.235.211.13]) by fwd28.aul.t-online.de with esmtp id 1Iqp71-0FzrPM0; Sat, 10 Nov 2007 13:06:55 +0100 Message-ID: <47359EDE.2000102@t-online.de> Date: Sat, 10 Nov 2007 13:06:54 +0100 From: Christian Franke User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070802 SeaMonkey/1.1.4 MIME-Version: 1.0 To: The development of GRUB 2 References: <473230F2.6040305@t-online.de> <87ejezla2g.fsf@xs4all.nl> In-Reply-To: <87ejezla2g.fsf@xs4all.nl> Content-Type: multipart/mixed; boundary="------------040704030200050009090909" X-ID: TQXLfwZfZhsiJGoHUIScby-mJ-eavXlxwFVDRatFWZtiqELWyslCMtFhJX8xjdug1C X-TOI-MSGID: 67878081-3779-481c-a4cd-1dd44f8666f4 X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) Subject: Re: [PATCH] Avoid crash on empty menu X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: The development of GRUB 2 List-Id: The development of GRUB 2 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Nov 2007 12:07:18 -0000 This is a multi-part message in MIME format. --------------040704030200050009090909 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 * normal/menu.c (run_menu): Check for empty menu to avoid crash. (grub_menu_run): Likewise. --------------040704030200050009090909 Content-Type: text/x-patch; name="grub2-menu-crash-2.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="grub2-menu-crash-2.patch" --- 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); --------------040704030200050009090909--