[PATCH] ui/ncurses: Prevent crash if bd->image NULL

Samuel Mendoza-Jonas sam.mj at au1.ibm.com
Fri Jul 18 11:36:05 EST 2014


The discover server can pass boot options with no actual
boot data if parsing conf files such as:

label Dummy entry

label Rexec petitboot latest
	kernel tftp://host/petitboot/vmlinux
	initrd tftp://host/petitboot/rootfs.cpio.xz

Which leads to a boot_editor crash when comparing mountpoints.
We might still want to allow blank fields in boot entries,
so check for bd->image before searching sysinfo

Signed-off-by: Samuel Mendoza-Jonas <sam.mj at au1.ibm.com>
---
 ui/ncurses/nc-boot-editor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ui/ncurses/nc-boot-editor.c b/ui/ncurses/nc-boot-editor.c
index 329699a..987678e 100644
--- a/ui/ncurses/nc-boot-editor.c
+++ b/ui/ncurses/nc-boot-editor.c
@@ -394,7 +394,7 @@ static void boot_editor_find_device(struct boot_editor *boot_editor,
 	struct blockdev_info *bd_info, *tmp;
 	unsigned int i, len;
 
-	if (!sysinfo || !sysinfo->n_blockdevs)
+	if (!sysinfo || !sysinfo->n_blockdevs || !bd->image)
 		return;
 
 	/* find the device for our boot image, by finding the longest
-- 
1.9.3



More information about the Petitboot mailing list