[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
default menuentry matching similar entries is broken
From: |
Seth Goldberg |
Subject: |
default menuentry matching similar entries is broken |
Date: |
Fri, 2 Mar 2012 23:33:52 -0800 |
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.:
set default='entry a with more words'
menuentry "entry a" {
}
menuentry "entry a with more words" {
}
The default that will be booted will the the first one, which is clearly wrong.
Why was the *ptr1 == 0 code added? 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.
Thanks,
--S
- default menuentry matching similar entries is broken,
Seth Goldberg <=