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

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