From: Jeremy Kerr Date: Fri, 24 Jan 2014 05:45:24 +0000 (+0800) Subject: discover/grub2: skip menuentries that don't define a boot option X-Git-Tag: v1.0.0~255 X-Git-Url: https://git.ozlabs.org/?p=petitboot;a=commitdiff_plain;h=eea9a9fa697654ef26d7e2c1cee3b4ac610db643 discover/grub2: skip menuentries that don't define a boot option menuentries may perform arbitrary commands; we only want ones that define a boot option. This change doesn't add a boot option if we haven't seen at least a boot image defined in the menuentry. Signed-off-by: Jeremy Kerr --- diff --git a/discover/grub2/script.c b/discover/grub2/script.c index 642ed2a..3e2ee05 100644 --- a/discover/grub2/script.c +++ b/discover/grub2/script.c @@ -374,6 +374,9 @@ int statement_menuentry_execute(struct grub2_script *script, statements_execute(script, st->statements); + if (!opt->boot_image) + return -1; + opt->option->is_default = option_is_default(script, opt, id); discover_context_add_boot_option(script->ctx, opt);