Blame SOURCES/0251-Fix-menu-entry-selection-based-on-title.patch

8631a2
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
8631a2
From: Javier Martinez Canillas <javierm@redhat.com>
8631a2
Date: Fri, 30 Nov 2018 16:39:09 +0100
8631a2
Subject: [PATCH] Fix menu entry selection based on title
8631a2
8631a2
The get_entry_number_helper() function assumes that there could be a set
8631a2
of entries identifiers in a variable (i.e: as used in the fallback case)
8631a2
so iterates over the string until it finds a space to get the first id.
8631a2
8631a2
But this should only be done for indexes or entries id, since the title
8631a2
can contain spaces. In the case of title, the complete string should be
8631a2
used to select a given entry.
8631a2
8631a2
Resolves: rhbz#1654936
8631a2
8631a2
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
8631a2
---
8631a2
 grub-core/normal/menu.c | 7 ++-----
8631a2
 1 file changed, 2 insertions(+), 5 deletions(-)
8631a2
8631a2
diff --git a/grub-core/normal/menu.c b/grub-core/normal/menu.c
f6e916
index 95f7abaf2..fc25c702f 100644
8631a2
--- a/grub-core/normal/menu.c
8631a2
+++ b/grub-core/normal/menu.c
8631a2
@@ -217,14 +217,11 @@ get_entry_number_helper(grub_menu_t menu,
8631a2
 
8631a2
   for (i = 0, e = menu->entry_list; e; i++)
8631a2
     {
8631a2
-      int l = 0;
8631a2
-      while (val[l] && !grub_isspace(val[l]))
8631a2
-	l++;
8631a2
 
8631a2
-      if (menuentry_eq (e->title, val, l))
8631a2
+      if (menuentry_eq (e->title, val, -1))
8631a2
 	{
8631a2
 	  if (tail)
8631a2
-	    *tail = val + l;
8631a2
+	    *tail = NULL;
8631a2
 	  return i;
8631a2
 	}
8631a2
       e = e->next;