From 30545786bb310c0a754b406402d8a07de1fb7fae Mon Sep 17 00:00:00 2001 From: Edward Tomasz Napierala Date: Sun, 19 Feb 2017 16:08:58 +0000 Subject: [PATCH] Make mdconfig(8) not segfault when the kernel returns garbage data. MFC after: 2 weeks Sponsored by: DARPA, AFRL --- sbin/mdconfig/mdconfig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbin/mdconfig/mdconfig.c b/sbin/mdconfig/mdconfig.c index e86ffdc4e96..f1c013c8b9f 100644 --- a/sbin/mdconfig/mdconfig.c +++ b/sbin/mdconfig/mdconfig.c @@ -452,8 +452,8 @@ md_list(const char *units, int opt, const char *fflag) } gc = &pp->lg_config; type = geom_config_get(gc, "type"); - if (strcmp(type, "vnode") == 0 || - strcmp(type, "preload") == 0) { + if (type != NULL && (strcmp(type, "vnode") == 0 || + strcmp(type, "preload") == 0)) { file = geom_config_get(gc, "file"); if (fflag != NULL && strcmp(fflag, file) != 0)