summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kerr <jk@ozlabs.org>2013-05-07 14:36:51 +0800
committerJeremy Kerr <jk@ozlabs.org>2013-05-09 08:47:54 +0800
commit038cb53fa8e19592b9c7021176fda194799f1d51 (patch)
tree61dd1a791c222d7d0cb2711a81feb93a766ae136
parent488fa97839822949f855de1efa3cf47756b7f72b (diff)
downloadtalos-petitboot-038cb53fa8e19592b9c7021176fda194799f1d51.tar.gz
talos-petitboot-038cb53fa8e19592b9c7021176fda194799f1d51.zip
ui/nc: Handle cui_opt_data with no boot option more gracefully
We can currently segfault petitboot by escaping from the option editor (before entering any details), then trying to boot the new, empty option. This change adds some sanity checks to prevent a segfault. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
-rw-r--r--ui/ncurses/nc-cui.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ui/ncurses/nc-cui.c b/ui/ncurses/nc-cui.c
index 342b603..167c2bb 100644
--- a/ui/ncurses/nc-cui.c
+++ b/ui/ncurses/nc-cui.c
@@ -109,6 +109,11 @@ static int cui_boot(struct pmenu_item *item)
assert(cui->current == &cui->main->scr);
pb_log("%s: %s\n", __func__, cod->name);
+ if (!cod->opt) {
+ pb_log("%s: missing opt?\n", __func__);
+ return -1;
+ }
+
nc_scr_status_printf(cui->current, "Booting %s...", cod->name);
def_prog_mode();
OpenPOWER on IntegriCloud