grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: default menuentry matching similar entries is broken


From: Vladimir 'φ-coder/phcoder' Serbinenko
Subject: Re: default menuentry matching similar entries is broken
Date: Sat, 03 Mar 2012 12:09:07 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20120216 Icedove/8.0

On 03.03.2012 08:33, Seth Goldberg wrote:
Hi,

   This code in menu.c::menuentry_eq() looks wrong:

{
   const char *ptr1, *ptr2;
   ptr1 = title;
   ptr2 = spec;
   while (1)
     {
       if (*ptr2 == '>'&&  ptr2[1] != '>'&&  *ptr1 == 0)
         return 1;
       if (*ptr2 == '>'&&  ptr2[1] != '>')
         return 0;
       if (*ptr2 == '>')
         ptr2++;
       if (*ptr1 != *ptr2)
         return 0;
       if (*ptr1 == 0)<----
         return 1;
       ptr1++;
       ptr2++;
     }
}


   Specifically, if there are two menuentries that differ by adding characters, 
this function will match the wrong one, i.e.:
Have you actually tested this? Since from the code readin just before it we have:

      if (*ptr1 != *ptr2)
        return 0;

So the code you point at is trigered only if both *ptr1 and *ptr2 are 0
  Also, what's the deal with the '>' characters?  What are they supposed to do? I 
can't seem to find the use of'>'  documented anywhere.
It's for submenus:
"submenu>subsubmenu>entry"

  Thanks,
  --S
_______________________________________________
Grub-devel mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/grub-devel



--
Regards
Vladimir 'φ-coder/phcoder' Serbinenko




reply via email to

[Prev in Thread] Current Thread [Next in Thread]