> On 10 Nov 2025, at 1:08 PM, Michael Chang via Grub-devel <[email protected]> > wrote: > > The grub_strtol() call in blsuki_is_default_entry() can set grub_errno > to GRUB_ERR_BAD_NUMBER if the input string cannot be converted into any > valid digits. > > This errno value is currently left uncleared, which can lead to > unexpected behavior in subsequent logic that tests the result of a > function by checking grub_errno. > > Clear grub_errno and return false when GRUB_ERR_BAD_NUMBER is set, as > this specific error should be ignored in this context. > > Signed-off-by: Michael Chang <[email protected]>
Reviewed-by: Sudhakar Kuppusamy <[email protected]> Thanks, Sudhakar > --- > grub-core/commands/blsuki.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/grub-core/commands/blsuki.c b/grub-core/commands/blsuki.c > index 21d767f05..df25b6fbc 100644 > --- a/grub-core/commands/blsuki.c > +++ b/grub-core/commands/blsuki.c > @@ -1510,6 +1510,12 @@ blsuki_is_default_entry (const char *def_entry, > grub_blsuki_entry_t *entry, int > return true; > > def_idx = grub_strtol (def_entry, &def_entry_end, 0); > + if (grub_errno == GRUB_ERR_BAD_NUMBER) > + { > + grub_errno = GRUB_ERR_NONE; > + return false; > + } > + > if (*def_entry_end != '\0' || def_idx < 0 || def_idx > GRUB_INT_MAX) > return false; > > -- > 2.51.1 > > > _______________________________________________ > Grub-devel mailing list > [email protected] > https://lists.gnu.org/mailman/listinfo/grub-devel _______________________________________________ Grub-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/grub-devel
